随笔分类 - LeetCode
摘要:给定一个仅包含大小写字母和空格 ' ' 的字符串 s,返回其最后一个单词的长度。 如果字符串从左向右滚动显示,那么最后一个单词就是最后出现的单词。 如果不存在最后一个单词,请返回 0 。 说明:一个单词是指仅由字母组成、不包含任何空格的 最大子字符串。 示例: 输入: "Hello World" 输
        阅读全文
                
摘要:class Solution { public ListNode mergeTwoLists(ListNode l1, ListNode l2) { if (l1 == null) { return l2; } else if (l2 == null) { return l1; } else if 
        阅读全文
                
摘要:class Solution { public double findMedianSortedArrays(int[] A, int[] B) { int m = A.length; int n = B.length; if (m > n) { // to ensure m<=n int[] tem
        阅读全文
                
摘要:public class Solution { public int lengthOfLongestSubstring(String s) { int n = s.length(); int ans = 0; for (int i = 0; i < n; i++) for (int j = i + 
        阅读全文
                
摘要:public ListNode addTwoNumbers(ListNode l1, ListNode l2) { ListNode dummyHead = new ListNode(0); ListNode p = l1, q = l2, curr = dummyHead; int carry =
        阅读全文
                
摘要:class Solution { public int[] twoSum(int[] nums, int target) { for (int i = 0; i < nums.length;i++){ for(int j = i + 1;j < nums.length;j++){ if (nums[
        阅读全文
                

 
         浙公网安备 33010602011771号
浙公网安备 33010602011771号