摘要: Given an integer, write a function to determine if it is a power of two. Given an integer, write a function to determine if it is a power of two. Give 阅读全文
posted @ 2016-06-15 14:38 dylqt 阅读(136) 评论(0) 推荐(0) 编辑
摘要: Majority Element Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You ma 阅读全文
posted @ 2016-06-15 14:37 dylqt 阅读(107) 评论(0) 推荐(0) 编辑
摘要: Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. For example: Given num = 38, the process is like: 阅读全文
posted @ 2016-06-15 14:37 dylqt 阅读(110) 评论(0) 推荐(0) 编辑
摘要: You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you cl 阅读全文
posted @ 2016-06-15 14:36 dylqt 阅读(172) 评论(0) 推荐(0) 编辑
摘要: Valid Anagram Given two strings s and t, write a function to determine if t is an anagram of s. For example,s = "anagram", t = "nagaram", return true. 阅读全文
posted @ 2016-06-15 14:36 dylqt 阅读(114) 评论(0) 推荐(0) 编辑
摘要: Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the characters in s can be replaced to get t. All occurrenc 阅读全文
posted @ 2016-06-15 14:35 dylqt 阅读(115) 评论(0) 推荐(0) 编辑