ACM算法
east2011east
这个作者很懒,什么都没留下…
展开
-
74. Search a 2D Matrix
这道题题目要求很简单,说白了就是二维数组的二分查找,代码如下import java.util.Random;/** * Created by zhangwd4 on 2017/11/23. */public class LeetCode74 { public boolean searchMatrix(int[][] matrix, int target) {原创 2017-11-23 18:31:53 · 176 阅读 · 0 评论 -
34. Search for a Range
一开始写错了代码如下class Solution { public int[] searchRange(int[] nums, int target) { int[] result = new int[]{-1,-1}; if(nums == null || nums.length==0){ return result;原创 2017-11-28 17:50:35 · 161 阅读 · 0 评论 -
leetcode刷题-堆栈3
package com.zwd.wkst.leetcode.stack;import java.util.Stack;/** * Created by zhangwd4 on 2017/11/2. * * Given a string containing just the characters '(', ')', '{', '}', '[' and ']', * determin原创 2017-11-02 17:03:30 · 171 阅读 · 0 评论 -
leetcode刷题-堆栈2
package com.zwd.wkst.leetcode.stack;import java.util.Stack;/** * Created by zhangwd4 on 2017/11/2. * * Given a string containing just the characters '(' and ')', * find the length of the longe原创 2017-11-02 15:10:47 · 202 阅读 · 0 评论 -
leetcode刷题-堆栈
堆栈!原创 2017-11-02 14:11:33 · 326 阅读 · 0 评论 -
leetcode题目分类
利用堆栈:http://oj.leetcode.com/problems/evaluate-reverse-polish-notation/http://oj.leetcode.com/problems/longest-valid-parentheses/ (也可以用一维数组,贪心)http://oj.leetcode.com/problems/valid-parentheses/转载 2017-11-02 13:43:08 · 383 阅读 · 0 评论 -
5. Longest Palindromic Substring
/** * Created by zhangwd4 on 2017/12/25. * * 题目意思是:找出一个字符串的最大回文子字符串。意思就是中心对称的子字符串。当 * 然分两种情况 * 1 奇数类型的对称 如 aba * 2 偶数类型的对称 如 abba * */public class LeetCode5 { int start = 0; int end原创 2017-12-25 17:45:44 · 148 阅读 · 0 评论