上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 23 下一页
摘要: problem:Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents you... 阅读全文
posted @ 2015-07-09 15:09 尾巴草 阅读(161) 评论(0) 推荐(0) 编辑
摘要: problem:Given a list of non negative integers, arrange them such that they form the largest number.For example, given [3, 30, 34, 5, 9], the largest f... 阅读全文
posted @ 2015-07-08 16:33 尾巴草 阅读(195) 评论(0) 推荐(0) 编辑
摘要: 问题描述:用键盘输入一个高精度的正整数N,去掉其中S个数字后剩下的数字按原左右次序排列组成一个新的正整数。 编程给定的N和S,寻找一个方案使得剩下的数字哦组成的新数最小。思路解析: 使用逼近目标的贪心法来逐一逼近删除其中s个数符,每一步总数选择一个是剩下的数最小的数符删除。这样的贪心选择因为... 阅读全文
posted @ 2015-07-08 15:35 尾巴草 阅读(3141) 评论(0) 推荐(1) 编辑
摘要: 解法一:判断一个数是否为2的n次方 若一个数为2的n次方的话 它的二进制则为最高位为1 其余为0 1 class Solution { 2 public: 3 bool isPowerOfTwo(int n) { 4 5 if(n>1;13 ... 阅读全文
posted @ 2015-07-07 11:04 尾巴草 阅读(205) 评论(0) 推荐(0) 编辑
摘要: Factorial Trailing ZeroesGiven an integern, return the number of trailing zeroes inn!.Note:Your solution should be in logarithmic time complexity.Cred... 阅读全文
posted @ 2015-07-02 11:17 尾巴草 阅读(169) 评论(1) 推荐(0) 编辑
摘要: Problem:Rotate an array of n elements to the right by k steps.For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,... 阅读全文
posted @ 2015-07-02 10:00 尾巴草 阅读(112) 评论(0) 推荐(0) 编辑
摘要: problem: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 occ... 阅读全文
posted @ 2015-07-01 10:24 尾巴草 阅读(145) 评论(0) 推荐(0) 编辑
摘要: problem:Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive... 阅读全文
posted @ 2015-06-30 10:51 尾巴草 阅读(204) 评论(0) 推荐(0) 编辑
摘要: Problem:Reverse a linked list from position m to n. Do it in-place and in one-pass. For example:Given 1->2->3->4->5->NULL, m = 2 and n = 4,return 1->4... 阅读全文
posted @ 2015-06-24 11:16 尾巴草 阅读(153) 评论(0) 推荐(0) 编辑
摘要: Problem:Description:Count the number of prime numbers less than a non-negative number, n.Credits:Special thanks to @mithmatt for adding this problem a... 阅读全文
posted @ 2015-06-16 21:51 尾巴草 阅读(156) 评论(0) 推荐(0) 编辑
上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 23 下一页