上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 27 下一页
摘要: Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?题意:判断链表是否成环。注意:最后一个节点的next指针,有可能指向链表中任意一个节点方法一:使用HashSet,保存遍历过的节点的HashCodepublic class Solut... 阅读全文
posted @ 2017-02-28 00:18 xiejunzhao 阅读(133) 评论(0) 推荐(0)
摘要: You have a total of n coins that you want to form in a staircase shape, where every k-th row must have exactly k coins.Given n, find the total number of full staircase rows that can be formed.n is a n... 阅读全文
posted @ 2017-02-27 22:58 xiejunzhao 阅读(137) 评论(0) 推荐(0)
摘要: public getRandomArr(num:number): number[]{ var array:number[] = new Array; //给原始数组original赋值 var i :number; for(i= 0;i < num;i++) { array[i] = i; }// 打乱数组... 阅读全文
posted @ 2017-02-25 11:11 xiejunzhao 阅读(2373) 评论(0) 推荐(0)
摘要: function(str){ var realLength = 0, len = str.length, charCode = -1; for (var i = 0; i = 0 && charCode <= 128) { realLength += 1; } else { realLength += 2; ... 阅读全文
posted @ 2017-02-25 11:08 xiejunzhao 阅读(205) 评论(0) 推荐(0)
摘要: function(num) { var number = parseFloat(num)*100; return parseInt(number+0.5)/100;};null 阅读全文
posted @ 2017-02-25 11:07 xiejunzhao 阅读(124) 评论(0) 推荐(0)
摘要: static public void DeleteFolder(string dir){ int num = 0; foreach (string d in Directory.GetFileSystemEntries(dir)) { if (File.Exists(d)) { FileInfo fi = new FileInfo... 阅读全文
posted @ 2017-02-25 11:03 xiejunzhao 阅读(211) 评论(0) 推荐(0)
摘要: Given a word, you need to judge whether the usage of capitals in it is right or not.We define the usage of capitals in a word to be right when one of the following cases holds:All letters in this word... 阅读全文
posted @ 2017-02-25 11:02 xiejunzhao 阅读(190) 评论(0) 推荐(0)
摘要: Given numRows, generate the first numRows of Pascal's triangle.For example, given numRows = 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1] ] 题意:构造杨辉三角static public List> Generate... 阅读全文
posted @ 2017-02-24 23:38 xiejunzhao 阅读(201) 评论(0) 推荐(0)
摘要: Count the number of segments in a string, where a segment is defined to be a contiguous sequence of non-space characters.Please note that the string does not contain any non-printable characters.Examp... 阅读全文
posted @ 2017-02-24 23:37 xiejunzhao 阅读(96) 评论(0) 推荐(0)
摘要: Given a non-negative integer represented as a non-empty array of digits, plus one to the integer.You may assume the integer do not contain any leading zero, except the number 0 itself.The digits are s... 阅读全文
posted @ 2017-02-23 23:34 xiejunzhao 阅读(193) 评论(0) 推荐(0)
上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 27 下一页