水下功夫做透,水上才能顺风顺水。
上一页 1 2 3 4 5 6 7 8 9 10 ··· 40 下一页
摘要: 给定一个整数数组 nums ,找到一个具有最大和的连续子数组(子数组最少包含一个元素),返回其最大和。 示例: 输入: [-2,1,-3,4,-1,2,1,-5,4], 输出: 6 解释: 连续子数组 [4,-1,2,1] 的和最大,为 6。(只求最大子序和,不是最大子序区间) 思路 假设 nums 阅读全文
posted @ 2022-03-05 20:20 北方寒士 阅读(59) 评论(0) 推荐(0)
摘要: 动态方程:d[i][j] = (a[i]=a[j])&&d[i+1][j-1]public String longestPalindrome(String str) { if (str==null||str.length()==1) { return str; } int len = str.len 阅读全文
posted @ 2022-03-05 19:57 北方寒士 阅读(36) 评论(0) 推荐(0)
摘要: public ListNode removeNthFromEnd(ListNode head, int n) { ListNode before = head; ListNode after = head; if(head==null){ return null; } while(n!=0){ be 阅读全文
posted @ 2022-03-05 18:52 北方寒士 阅读(55) 评论(0) 推荐(0)
摘要: 给定一个整数数组 nums 和一个整数目标值 target,请你在该数组中找出 和为目标值 target 的那 两个 整数,并返回它们的数组下标public int[] twoSum(int[] nums, int target) { int[] a = new int[2]; Map<Intege 阅读全文
posted @ 2022-03-05 11:49 北方寒士 阅读(22) 评论(0) 推荐(0)
摘要: public ListNode addTwoNumbers(ListNode l1, ListNode l2) { ListNode res = new ListNode(); ListNode cur = res; int sum = 0; int carry = 0; while(l1!=nul 阅读全文
posted @ 2022-03-05 11:35 北方寒士 阅读(72) 评论(0) 推荐(0)
摘要: public ListNode mergeTwoLists(ListNode list1, ListNode list2) { // 使用带头结点的链表解决问题 // 待输出链表的头部 ListNode head = new ListNode(); // 待输出链表的 cur 结点 ListNode 阅读全文
posted @ 2022-03-03 15:53 北方寒士 阅读(75) 评论(0) 推荐(0)
摘要: 给定一个长度为 n 的整数数组 nums 。 假设 arrk 是数组 nums 顺时针旋转 k 个位置后的数组,我们定义 nums 的 旋转函数 F 为: F(k) = 0 * arrk[0] + 1 * arrk[1] + ... + (n - 1) * arrk[n - 1]返回 F(0), F 阅读全文
posted @ 2022-02-27 20:57 北方寒士 阅读(156) 评论(0) 推荐(0)
摘要: class Solution { public int lengthOfLongestSubstring(String s) { int len = s.length(), max = 0; //key是字符,value是字符位置 Map<Character, Integer> map = new 阅读全文
posted @ 2022-02-26 22:28 北方寒士 阅读(46) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2022-02-26 18:04 北方寒士 阅读(93) 评论(0) 推荐(0)
摘要: 1. 查看指定行的日志 sed -n '341400,341470p' ./edu-message-info-2022-02-10-10.0.3.212.log 阅读全文
posted @ 2022-02-10 16:10 北方寒士 阅读(121) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 8 9 10 ··· 40 下一页