Given an integer, write a function to determine if it is a power of two.

題意

文章標籤

Davis 發表在 痞客邦 留言(0) 人氣()

Given an integer, write a function to determine if it is a power of three.

題意

文章標籤

Davis 發表在 痞客邦 留言(0) 人氣()

Given an integer, write an algorithm to convert it to hexadecimal. For negative integer, two's complement method is used.

題意

文章標籤

Davis 發表在 痞客邦 留言(0) 人氣()

Given two non-negative integers num1 and num2 represented as string, return the sum of num1 and num2.

題意

文章標籤

Davis 發表在 痞客邦 留言(0) 人氣()

Given an array of integers, every element appears twice except for one. Find the single one.

Note:

文章標籤

Davis 發表在 痞客邦 留言(0) 人氣()

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 turns to remove 1 to 3 stones. The one who removes the last stone will be the winner. You will take the first turn to remove the stones.

Both of you are very clever and have optimal stratgies for the game. Write a function to determine whether you can win the game given the number of stones in the heap.

文章標籤

Davis 發表在 痞客邦 留言(0) 人氣()

Given an array of integers where 1 <= a[i] <= n (n=size of array), some elements appear twice and others appear once.

Find all the elements of [1, n] inclusive that do not appear in this array.

Davis 發表在 痞客邦 留言(0) 人氣()

You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water.

Grid cells are connected horizontally/vertically (not diagonally). The grid is completely surrounded by water, and there is exactly one island (i.e., one or more connected land cells).

Davis 發表在 痞客邦 留言(0) 人氣()

Write a function that takes a string as input and returns the string reversed.

將輸入的字串反轉

文章標籤

Davis 發表在 痞客邦 留言(0) 人氣()

Write a program that outputs the string representation of numbers from 1 to n.

But for multiples of three it should ouput "Fizz" instead of the number and for the multiples of five output "Buzz". For numbers which are multiples of both three and five output 'FizzBuzz"

Davis 發表在 痞客邦 留言(0) 人氣()