发布时间:2015-03-27 11:41:02
可能很多java的初学者对String的存储和赋值有迷惑,以下是一个很简单的测试用例,你只需要花几分钟时间便可理解。1.在看例子之前,确保你理解以下几个术语:栈:由JVM分配区域,用于保存线程执行的动作和数据引用。栈是一个运行的单位,Java中一个线程就会相应有一个线程栈与之对应。堆:由JVM分配的,用于存.........【阅读全文】
发布时间:2015-03-27 10:57:33
//Given an array of integers, find two numbers such that they add up to a specific target number.////The function twoSum should return indices of the two numbers such that they add up to the target, where index1 must be less than index2. Please note that your returned answers (both index1 and inde.........【阅读全文】
发布时间:2015-03-26 18:33:01
Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set.get(key) - Get the value (will always be positive) of the key if the key exists in the cache, otherwise return -1.set(key, value) - Set o.........【阅读全文】
发布时间:2015-03-22 17:08:30
import java.util.ArrayList;import java.util.HashSet;import java.util.Set;//Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.////For example, given//s = "leetcode",//.........【阅读全文】
发布时间:2015-03-22 17:07:31
import java.util.ArrayList;import java.util.Arrays;import java.util.List;public class threeSum {public static void main(String[] arg){int[] a=new int[]{0,0,0};System.out.print(threeSumSolution(a));}public static List<List<Integer>> threeSumSolution(int[] num) {List<List<Integer>> temp.........【阅读全文】