上一页 1 ··· 16 17 18 19 20 21 22 23 24 ··· 27 下一页
摘要: Given an array and a value, remove all instances of that value in place and return the new length.Do not allocate extra space for another array, you must do this in place with constant memory.The orde... 阅读全文
posted @ 2017-02-22 23:53 xiejunzhao 阅读(159) 评论(0) 推荐(0)
摘要: static public void DeleteRepeatChar(string s){ Dictionary d = new Dictionary(); foreach (var c in s){ int num = 0; if (d.TryGetValue(c, out num)){ d[c] += 1; ... 阅读全文
posted @ 2017-02-20 22:55 xiejunzhao 阅读(223) 评论(0) 推荐(0)
摘要: 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"题意:反转字符串中元音字母的位置方法1:用... 阅读全文
posted @ 2017-02-20 00:06 xiejunzhao 阅读(205) 评论(0) 推荐(0)
摘要: Given a positive integer num, write a function which returns True if num is a perfect square else False.Note: Do not use any built-in library function such as sqrt.Example 1:Input: 16 Returns: True Ex... 阅读全文
posted @ 2017-02-19 22:21 xiejunzhao 阅读(214) 评论(0) 推荐(0)
摘要: You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent house... 阅读全文
posted @ 2017-02-19 00:30 xiejunzhao 阅读(160) 评论(0) 推荐(0)
摘要: 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 loops/rec... 阅读全文
posted @ 2017-02-18 11:32 xiejunzhao 阅读(240) 评论(0) 推荐(0)
摘要: Given an integer, return its base 7 string representation.Example 1:Input: 100 Output: "202" Example 2:Input: -7 Output: "-10" Note: The input will be in range of [-1e7, 1e7].public class Solution { ... 阅读全文
posted @ 2017-02-13 23:06 xiejunzhao 阅读(359) 评论(0) 推荐(0)
摘要: Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [-2,1,-3,4,-1,2,1,-5,4],the contiguous subarray [4,-1,2,1] has the ... 阅读全文
posted @ 2017-02-13 22:39 xiejunzhao 阅读(133) 评论(0) 推荐(0)
摘要: Given scores of N athletes, find their relative ranks and the people with the top three highest scores, who will be awarded medals: "Gold Medal", "Silver Medal" and "Bronze Medal".Example 1:Input: [5,... 阅读全文
posted @ 2017-02-12 18:36 xiejunzhao 阅读(155) 评论(0) 推荐(0)
摘要: Given a List of words, return the words that can be typed using letters of alphabet on only one row's of American keyboard like the image below.Input: ["Hello", "Alaska", "Dad", "Peace"] Output: ["Ala... 阅读全文
posted @ 2017-02-12 00:25 xiejunzhao 阅读(142) 评论(0) 推荐(0)
上一页 1 ··· 16 17 18 19 20 21 22 23 24 ··· 27 下一页