IncredibleThings

导航

2016年7月19日 #

LeetCode-Guess Number Higher or Lower

摘要: We are playing the Guess Game. The game is as follows: I pick a number from 1 to n. You have to guess which number I picked. Every time you guess wrong, I'll tell you whether the number is higher o... 阅读全文

posted @ 2016-07-19 22:56 IncredibleThings 阅读(139) 评论(0) 推荐(0) 编辑

LeetCode-Intersection of Two Arrays II

摘要: Given two arrays, write a function to compute their intersection. Example: Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2, 2]. Note: Each element in the result should appear as many times as... 阅读全文

posted @ 2016-07-19 21:49 IncredibleThings 阅读(120) 评论(0) 推荐(0) 编辑

LeetCode-Intersection of Two Arrays

摘要: Given two arrays, write a function to compute their intersection. Example: Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2]. Note: Each element in the result must be unique. The result can be... 阅读全文

posted @ 2016-07-19 06:09 IncredibleThings 阅读(196) 评论(0) 推荐(0) 编辑

LeetCode-Reverse Vowels of a String

摘要: Write a function that takes a string as input and reverse only the vowels of a string. Example 1: Given s = "hello", return "holle". Example 2: Given s = "leetcode", return "leotcede". public cla... 阅读全文

posted @ 2016-07-19 05:00 IncredibleThings 阅读(112) 评论(0) 推荐(0) 编辑

LeetCode-Reverse String

摘要: Write a function that takes a string as input and returns the string reversed. Example: Given s = "hello", return "olleh". public class Solution { public String reverseString(String s) { ... 阅读全文

posted @ 2016-07-19 03:28 IncredibleThings 阅读(91) 评论(0) 推荐(0) 编辑

LeetCode-Power of Four

摘要: Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Example: Given num = 16, return true. Given num = 5, return false. Follow up: Could you solve it without loo... 阅读全文

posted @ 2016-07-19 03:13 IncredibleThings 阅读(100) 评论(0) 推荐(0) 编辑

LeetCode-Power of Three

摘要: Given an integer, write a function to determine if it is a power of three. Follow up: Could you do it without using any loop / recursion? public class Solution { private static final double ep... 阅读全文

posted @ 2016-07-19 03:05 IncredibleThings 阅读(126) 评论(0) 推荐(0) 编辑