随笔分类 -  java&LeetCode

摘要:String 字符串常量StringBuffer 字符串变量(线程安全)StringBuilder 字符串变量(非线程安全) 简要的说, String 类型和 StringBuffer 类型的主要性能区别其实在于 String 是不可变的对象, 因此在每次对 String 类型进行改变的时候其实都等 阅读全文
posted @ 2017-03-17 17:17 世人谓我恋长安 阅读(99) 评论(0) 推荐(0)
摘要:Implement Queue using Stacks Implement the following operations of a queue using stacks. push(x) -- Push element x to the back of queue. pop() -- Remo 阅读全文
posted @ 2017-03-17 16:49 世人谓我恋长安 阅读(162) 评论(0) 推荐(0)
摘要:Assign Cookies Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each 阅读全文
posted @ 2017-03-16 18:52 世人谓我恋长安 阅读(127) 评论(0) 推荐(0)
摘要:Construct the Rectangle For a web developer, it is very important to know how to design a web page's size. So, given a specific rectangular web page’s 阅读全文
posted @ 2017-03-16 17:02 世人谓我恋长安 阅读(167) 评论(0) 推荐(0)
摘要:Palindrome Number Determine whether an integer is a palindrome. Do this without extra space. 阅读全文
posted @ 2017-03-15 22:41 世人谓我恋长安 阅读(103) 评论(0) 推荐(0)
摘要:Tenth Line shell编程 从file.txt中读数据,echo输出到控制台 while...do...done是bash中的语法结构 阅读全文
posted @ 2017-03-15 21:17 世人谓我恋长安 阅读(213) 评论(0) 推荐(0)
摘要:Best Time to Buy and Sell Stock II Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find 阅读全文
posted @ 2017-03-13 17:14 世人谓我恋长安 阅读(86) 评论(0) 推荐(0)
摘要:Largest Palindrome Product Find the largest palindrome made from the product of two n-digit numbers. Since the result could be very large, you should 阅读全文
posted @ 2017-03-13 16:29 世人谓我恋长安 阅读(222) 评论(0) 推荐(0)
摘要:Search Insert Position Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if 阅读全文
posted @ 2017-03-13 10:47 世人谓我恋长安 阅读(86) 评论(0) 推荐(0)
摘要:Reverse Linked List Reverse a singly linked list. 此题不难,附上java代码: 阅读全文
posted @ 2017-03-12 12:42 世人谓我恋长安 阅读(104) 评论(0) 推荐(0)
摘要:Linked List Cycle Given a linked list, determine if it has a cycle in it. Follow up:Can you solve it without using extra space? 此题并不难,声明2个指针一个步长1,一个步长 阅读全文
posted @ 2017-03-12 11:11 世人谓我恋长安 阅读(133) 评论(0) 推荐(0)