- 博客(96)
- 资源 (10)
- 收藏
- 关注
转载 忘记redhat linux root密码怎么办
转载之http://jingyan.baidu.com/article/5225f26b139257e6fa09089e.html
2014-06-25 22:36:11 398
原创 Copy List with Random Pointer
/** * Definition for singly-linked list with a random pointer. * class RandomListNode { * int label; * RandomListNode next, random; * RandomListNode(int x) { this.label = x; } * };
2014-06-23 00:41:22 405
原创 leetcode:3Sum Closest
public class Solution { public int threeSumClosest(int[] num, int target) { Arrays.sort(num); int len = num.length - 2; int sum = 0; int min = Integer.MAX_VALUE;
2014-06-17 11:23:09 347
转载 leetcode:Container With Most Water
转http://blog.csdn.net/doc_sgl/article/details/12188919
2014-06-17 11:14:55 350
原创 leetcode:Longest Substring Without Repeating Characters
求出最长的不重复子串public class Solution { public int lengthOfLongestSubstring(String s) { if (s.length() == 0) { return 0; } HashMap map = new HashMap<>();
2014-06-16 18:45:04 327
原创 leetcode:Reverse Integer
public class Solution { public int reverse(int x) { boolean flag = x < 0; ArrayList sta = new ArrayList<>(); x = Math.abs(x); while(x != 0){ sta.add(x %
2014-06-16 17:48:45 347
原创 leetcode:Palindrome Number
判断一个数字是否回文数字public class Solution { public boolean isPalindrome(int x) { if(x<0) return false; int div = 1; while(x/div >=10) div*=10;
2014-06-16 17:46:45 340
原创 leetcode:Two Sum
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, whe
2014-06-16 00:46:29 321
转载 leetcode:
这个做法是从别人copy而来,sixclass Solution {public: int firstMissingPositive(int A[], int n) { int i = 0; while (i < n) { if (A[i] != (i+1) && A[i] >= 1 && A[i] <= n &
2014-06-16 00:37:50 337
原创 leetcode: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 it were inserted in order.You may assume no duplicates in the array.
2014-06-16 00:30:49 269
原创 leetcode:Search for a Range
Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the order of O(log n).If the target is not found
2014-06-16 00:29:18 528
原创 leetcode:Count and Say
The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1 is read off as "one 1" or 11.11 is read off as "two 1s" or 21.21 is read off as
2014-06-16 00:25:53 370
原创 leetcode:Permutations
无重复元素的全排序public class Solution { static List> ans = new ArrayList>(); static ArrayList stack = new ArrayList(); static int[] num; public List> permute(int[] num) { ans.clear(
2014-06-16 00:23:03 305
原创 leetcode:Length of Last Word
求出最后一个单词的长度,数据有quankpublic class Solution { public int lengthOfLastWord(String s) { int ans = 0; int pre = -1, next = 0; int i; for( i = 0; i < s.length(); ++i){
2014-06-15 23:51:03 371
原创 leetcode:Unique Paths
递推表达式给出mpublic class Solution { public int uniquePaths(int m, int n) { int[][] x = new int[m][n]; int i = 0, j = 0; x[0][0] = 1; for( i = 0; i < m; ++i){
2014-06-15 23:43:27 278
原创 leetcode:Merge Two Sorted Lists
/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { * val = x; * next = null; * } * } */public
2014-06-15 23:36:38 375
原创 leetcode:Sqrt(x)
public class Solution { public int sqrt(int x) { double ans = x; while(Math.abs(ans * ans - x) > 0.0001) { ans = (ans + x / ans) / 2; }
2014-06-15 23:35:02 291
原创 leetcode:
public class Solution { public void setZeroes(int[][] matrix) { boolean visRow[] = new boolean[matrix.length]; boolean visCol[] = new boolean[matrix[0].length]; Arrays.fill
2014-06-15 16:20:52 368
原创 leetcode:Search a 2D Matrix
public class Solution { public boolean searchMatrix(int[][] matrix, int target) { int row = -1; for(int i = matrix.length - 1; i >= 0; --i){ if(matrix[i][0] <= target){
2014-06-15 16:18:35 414
原创 leetcode:Sort Colors
简单的计数排序public class Solution { public void sortColors(int[] A) { int red = 0, blue = 0, white = 0; for(int i = 0; i < A.length; ++i){ if(A[i] == 0)red++;
2014-06-15 16:15:54 245
axis2与spring集成
2015-05-14
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人