Question: You are climbing stairs. It takes n steps to get to the top. Each time, you can take 1 step or 2 steps. How many distinct ways to get to …
Question: Determine the length of the last word in a string given in C, as const char* Problem Description: http://oj.leetcode.com/problems/length-of-last-word/ A word is defined as a sequence of non-space characters. …
Well, I have a detailed post that presents two solutions to solve the classic n-queen problem. The problem asks you to find the number of solutions to put n queens in …
Source: http://oj.leetcode.com/problems/powx-n/ Implement Pow(x, n) which computes The given parameter x is a 64-bit double and n is a 32-bit integer. The quick solution may be so obvious, using bruteforce, iterate n times that multiplies x and gives a straightforward result. class Solution …
Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf …