본문 바로가기

전공지식/Leetcode문제

(4)
136. Single Number - 원문Given an array of integers, every element appears twice except for one. Find that single one.Note: Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory? - 해석정수 배열을 감안할 때 모든 요소는 하나만 제외하고 두 번 나타납니다. 그 하나를 찾아라.노트:알고리즘의 선형 런타임 복잡성이 있어야합니다. 여분의 메모리를 사용하지 않고 구현할 수 있습니까? - 회고 이 문제를 처음 봤을 때 leetcode 문제 중 448. Find All Numbers Disappeared in an Arr..
448. Find All Numbers Disappeared in an Array - 원문 Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements of [1, n] inclusive that do not appear in this array. Could you do it without extra space and in O(n) runtime? You may assume the returned list does not count as extra space. - 해석 1 ≤ a [i] ≤ n (n은 배열의 크기) 인 정수 배열이 주어지면 일부 요소는 두 번 나타나고 다른 요소는 한 번 나타납니다...
461. Hamming Distance - 원문 The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Given two integers x and y, calculate the Hamming distance. - 해석 두 정수 사이의 해밍 거리는 비트가 다른 위치의 갯수입니다. 두 개의 정수 x와 y가 주어지면, 해밍 거리를 계산하십시오. Note: 0 ≤ x, y < 231. Example:Input: x = 1, y = 4 Output: 2 Explanation: 1 (0 0 0 1) 4 (0 1 0 0) ↑ ↑ The above arrows point to positions where ..
SwapPairs 문제 24. Swap Nodes in Pairs Given a linked list, swap every two adjacent nodes and return its head. For example, Given 1->2->3->4, you should return the list as 2->1->4->3. Your algorithm should use only constant space. You may not modify the values in the list, only nodes itself can be changed. Subscribe to see which companies asked this question 해석 : 연결된 목록이 있으면 인접한 두 노드를 서로 바꾸고 head를 반환하십시오.예를 들어..