Tag: leetcode online judge
Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only …
Leetcode Online Judge: https://leetcode.com/problems/nim-game/ You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take …
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: …
Count the number of prime numbers less than a non-negative number, n. Submit your solution to: https://leetcode.com/problems/count-primes/ Naive Solution The first solution is straightforward, a prime number is a …
Given a non-negative integer number, repeatedly add all its digits until the result has only one digit. For example: Given num = 38, the process is like: 3 + …