Tag: coding exercise
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 …
This puzzle reveals that you don’t need to write a few lines of shell scripts, you would just need one line (using pipes) to achieve complex tasks. See below: …
Given an integer, write a function to determine if it is a power of two. This is not new, and the solution has been posted at Using a Faster …