LeetCode – 349. Intersection of Two Arrays
Given two arrays, write a function to compute their intersection. Example: Given nums1 = [1, 2, 2, 1…
LeetCode – 303. Range Sum Query – Immutable
Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive…
LeetCode – 283. Move Zeroes
Given an array nums, write a function to move all 0‘s to the end of it while maintaining the r…
LeetCode – 268. Missing Number
Given an array containing n distinct numbers taken from 0, 1, 2, …, n, find the one that is missin…
LeetCode – 169. Majority Element
Given an array of size n, find the majority element. The majority element is the element that appear…
LeetCode – 219. Contains Duplicate II
Given an array of integers and an integer k, find out whether there are two distinct indices i and j…
LeetCode – 217. Contains Duplicate
Given an array of integers, find if the array contains any duplicates. Your function should return t…
LeetCode – 167. Two Sum II – Input array is sorted
Given an array of integers that is already sorted in ascending order, find two numbers such that the…
LeetCode – 122. Best Time to Buy and Sell Stock II
Say you have an array for which the ith element is the price of a given stock on day i. Design an al…
LeetCode – 121. Best Time to Buy and Sell Stock
Say you have an array for which the ith element is the price of a given stock on day i. If you were …