摘要: 用到了动态规划,看了题解写了以下思路 class Solution { public int maxSubArray(int[] nums) { // double res=-1E4; // System.out.println(res); //科学计数法 只能是double float型 int 阅读全文
posted @ 2021-10-31 16:37 Ssshiny 阅读(34) 评论(1) 推荐(0)
摘要: 很容易实现 最开始在不存在的元素找插入位置时饶了小小一点弯路 最开始想要每次mid改变都记录下来 改出来一点错误 class Solution { public int searchInsert(int[] nums, int target) { int loc=0; int low=0,high= 阅读全文
posted @ 2021-10-31 13:17 Ssshiny 阅读(30) 评论(1) 推荐(0)
摘要: 看了字符串截取子字符的库函数 第一次没有加等于号 舍去了末尾的比较这种情况 快速算法是kmp算法 class Solution { public int strStr(String haystack, String needle) { int loc=-1; for(int i=0;i<haysta 阅读全文
posted @ 2021-10-31 12:38 Ssshiny 阅读(34) 评论(0) 推荐(0)