LeetCode
WQ同学
这个作者很懒,什么都没留下…
展开
-
Leetcode 数组生成二叉树的工具
在刷leetcode 很多树题目的时候经常遇到这种情况,For example:Given BST [1,null,2,2], 1 \ 2 / 2发现测试的例子给的是一个数组 然而 需要输入的结果是一个树形结构每次手动的去创建比较麻烦,写了一个数组到树的一个小工具由于其中有null 的情况所以用的是装箱类,实现过程也比较简单,就是先创建根节点然后在...原创 2020-04-13 23:58:34 · 1807 阅读 · 0 评论 -
leetcode:combination-sum-ii
题目:https://leetcode.com/problems/combination-sum-ii/这题主要是使用数组里面的数字求出期望数字的组合可能这个要多一个去重下面是官方给出的例子Example 1:Input: candidates = [10,1,2,7,6,1,5], target = 8,A solution set is:[ [1, 7], [1, 2, ...原创 2019-03-06 12:45:47 · 195 阅读 · 0 评论 -
leetcode:combination-sum
题目:https://leetcode.com/problems/combination-sum/这题主要是使用数组里面的数字求出期望数字的组合可能下面是官方给出的例子:Example 1:Input: candidates = [2,3,6,7], target = 7,A solution set is:[ [7], [2,2,3]]Example 2:Input...原创 2019-03-06 11:32:57 · 234 阅读 · 0 评论 -
LeetCode:Container With Most Water
题目链接:https://leetcode.com/problems/container-with-most-water/description/ 文章地址: 项目源码:https://github.com/haha174/daylx Given n non-negative integers a1, a2, ..., an, where each represents a point at转载 2018-04-11 18:38:28 · 2781 阅读 · 0 评论 -
LeetCode:3Sum
题目链接:https://leetcode.com/problems/3sum/description/项目源码:https://github.com/haha174/daylx 假设3sum问题的目标是target。每次从数组中选出一个数k,从剩下的数中求目标等于target-k的2sum问题。这里需要注意的是有个小的trick:当我们从数组中选出第i数时,我们只需要求数值中从第i+1个到最后一转载 2018-04-16 19:47:11 · 2801 阅读 · 0 评论 -
LeetCode:Regular Expression Matching
Regular Expression Matching原创 2018-04-10 21:40:13 · 2746 阅读 · 0 评论 -
LeetCode:ZigZag Conversion
题目链接:https://leetcode.com/problems/zigzag-conversion/description/ 文章地址: 项目源码:https://github.com/haha174/daylx 其实这题:用case 数据反而不容易观察 不妨使用123456789当row=1 =>123456789当row=2 :1 3 5 7 92 4 6 ...原创 2018-04-02 21:55:48 · 2719 阅读 · 0 评论 -
多线程和并发库应用一传统线程创建
众所周知创建线程主要有两种方式一种是继承Thread 类一种是实现Runnable接口原创 2018-01-05 23:53:22 · 2776 阅读 · 0 评论 -
leetcode(4) 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 (m+n)).Example 1:nums1 = [1, 3]转载 2017-12-04 22:08:59 · 2720 阅读 · 0 评论 -
5. Longest Palindromic Substring
Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example:Input: “babad”Output: “bab”Note: “aba” is also a valid answer.Example:Input: “转载 2017-12-10 23:10:54 · 2709 阅读 · 0 评论 -
leetcode(2):Add Two Numbers
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it原创 2017-11-07 11:51:57 · 2744 阅读 · 0 评论 -
Longest Substring Without Repeating Characters
LeetCode(3):Given a string, find the length of the longest substring without repeating characters.原创 2017-11-07 11:24:20 · 2741 阅读 · 0 评论