摘要: 解法一: 动态规划 class Solution { public int longestValidParentheses(String s) { int n = s.length(); if(n < 2) return 0; char[] arr = s.toCharArray(); int[] 阅读全文
posted @ 2020-07-08 20:59 Sexyomaru 阅读(191) 评论(0) 推荐(0)
摘要: class Solution { //倍增思想 public int divide(int dividend, int divisor) { if(dividend == 0) return 0; if(dividend == Integer.MIN_VALUE && divisor == - 1) 阅读全文
posted @ 2020-07-08 20:51 Sexyomaru 阅读(235) 评论(0) 推荐(0)
摘要: class Solution { public ListNode reverseKGroup(ListNode head, int k) { if(head == null || head.next == null || k == 1) return head; ListNode node = he 阅读全文
posted @ 2020-07-08 20:45 Sexyomaru 阅读(166) 评论(0) 推荐(0)
摘要: class Solution { public int maxArea(int[] height) { int n = height.length; int l = 0, r = n - 1; int res = 0; while(l < r) { // 每次移动较低的指针,这样不会丢失最大值 re 阅读全文
posted @ 2020-07-08 20:39 Sexyomaru 阅读(91) 评论(0) 推荐(0)
摘要: class Solution { public boolean isMatch(String s, String p) { int m = s.length(), n = p.length(); char[] arrs = s.toCharArray(); char[] arrp = p.toCha 阅读全文
posted @ 2020-07-08 20:38 Sexyomaru 阅读(340) 评论(0) 推荐(0)
摘要: class Solution { public int myAtoi(String str) { str = str.trim(); int n = str.length(); if(n == 0) return 0; char[] arr = str.toCharArray(); int atoi 阅读全文
posted @ 2020-07-08 20:36 Sexyomaru 阅读(174) 评论(0) 推荐(0)
摘要: 本题解法很多,可用动态规划 中心扩展法 这里给出一种最快的方法manacher算法 class Solution { public String longestPalindrome(String s) { char[] arr = manacher(s.toCharArray()); int n = 阅读全文
posted @ 2020-07-08 20:33 Sexyomaru 阅读(109) 评论(0) 推荐(0)
摘要: class Solution { // 本题采用折半删除法 public double findMedianSortedArrays(int[] nums1, int[] nums2) { int k = nums1.length + nums2.length; if(k % 2 == 0) { r 阅读全文
posted @ 2020-07-08 20:25 Sexyomaru 阅读(132) 评论(0) 推荐(0)
摘要: 请注意本题有复杂度要求 O(n) 本题有一种很重要的思想,可以将本类统计问题,想象为上下车问题,我们不需要清楚的统计每个时间点有多少个人,只需要统计上车点上了多少人,下车点下了多少人,之后每个点人数可以表示为f(i) = f(i) + f(i-1) class Solution { public i 阅读全文
posted @ 2020-07-08 20:21 Sexyomaru 阅读(123) 评论(0) 推荐(0)
摘要: 1、Http和Https的区别 Http协议运行在TCP之上,明文传输,客户端与服务器端都无法验证对方的身份;Https是身披SSL(Secure Socket Layer)外壳的Http,运行于SSL上,SSL运行于TCP之上,是添加了加密和认证机制的HTTP。二者之间存在如下不同: 端口不同:H 阅读全文
posted @ 2020-07-08 17:00 Sexyomaru 阅读(149) 评论(0) 推荐(0)