Tag: leetcode
There are N gas stations along a circular route, where the amount of gas at station i is gas. You have a car with an unlimited gas tank and …
For example, Given nums = return 2. Note: Your algorithm should run in linear runtime complexity. Could you implement it using only constant extra space complexity? How many solutions …
Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the …
Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it …
You are given an array x of n positive numbers. You start at point (0,0) and moves x metres to the north, then x metres to the west, x …