LeetCode
wangci0211
这个作者很懒,什么都没留下…
展开
-
leetcode_给定一个整数数组,返回两个数字的索引,使其和等于特定的数
第一次书写答案时间复杂度为n^2,空间复杂度为1class Solution { public int[] twoSum(int[] nums, int target) { int[] arr1=new int[2]; // Arrays.sort(nums); ko: for(int j=0;j<nums.length-1;j++){...原创 2019-03-01 16:55:12 · 1853 阅读 · 0 评论 -
一个字符串中最长回文子串
Given a strings, find the longest palindromic substring ins. You may assume that the maximum length ofsis 1000.一般最长回文子串的理解为,正读和反读是一样的,换一种理解方式就是关于中间对称的,第二种理解更容易对算法产生理解class Solution { pub...原创 2019-03-29 16:29:26 · 202 阅读 · 0 评论