Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
Leetcode21.合并两个有序链表,文章目录questioncodesummaryattachquestioncodeclassSolution{publicListNodemergeTwoLists(ListNodel1,ListNodel2){ListNodeprehead=newListNode(-1,null);ListNodepre=prehead;//记录新构建链表的尾结点while(l1!=null&
Solution:see here解决办法:看这里LRU Cache LRU缓存Description:Design and implement a data structure ...
21 is read off as “one 2, then one 1” or 1211. Given an integer n, generate the nth term of the count-and-say sequence. Note: Each term of the sequence of integers will be represented as a string. Input: 4 Output: “1211” Day 1898 答案揭晓 DS Interview Question & Answer What...
21.接雨水 leetcode-cn.com/problem class Solution { /* 暴力搜索法 O(n^2),每到一个位置,就从当前位置向左搜索最大值并记录,再从当前位置向右搜索最大值并记录,然后取两者之间的较小值减去当前高度即可得到当前位置的雨水量 */ public int trap(int[] height) { if (height == null || height.leng...
Question : Given two words (start and end), and a dictionary, find all shortest transformation sequence(s) from start to end, such that: Only one letter can be changed at a time Each intermediate word must exist in the dictionary For example, Given: start = "hit" end = "cog" dict...
Leetcode -- Day 20 & Day 21 & Day 27 & Day 31 Binary search in sorted Array Question 1 Median of Two Sorted Arrays There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log...
LeetCode #21 Merge Two Sorted Lists Question Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. Solution Approach #1 /** * Definition for singly-linked list. ...
Note:This question is the same as 1038:https://leetcode.com/problems/binary-search-tree-to-greater-sum-tree/ 1. Please don't postany solutionsin this discussion. 2. The problem discussion is for asking questions about the problem or for sharing tips - anything except for solutions. ...
转载自:LeetCode Question Difficulty Distribution 1 Two Sum 2 5 array sort set Two Pointers 2 Add Two Numbers 3 4 linked list Two Pointers Math 3 Longest Substring Without Repeating Characters 3 2 string Two Pointers hashtable 4 Median of Two Sorted Arrays 5 3 array Binary Search 5 Longest ...