Category: c / c++
Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element. For example, Given …
Question: Write a function to return the intersection of two arrays: For example, the intersection of and returns . The return array should only contain unique numbers and the …
Question: How to determine if a linked list has a cycle? The Singly Linked List is defined as follows: struct ListNode { int val; ListNode *next; ListNode(int x) : …
There are two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. nums1 has enough space to hold additional elements from nums2. The number …
Given a linked list, swap every two adjacent nodes and return its head. You may not modify the values in the list’s nodes. Only nodes itself may be changed. …