leetcode
ballyyang
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
1. Two Sum
Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use the same ...原创 2018-07-02 22:29:56 · 171 阅读 · 0 评论 -
268. Missing Number
Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. Example 1: Input: [3,0,1] Output: 2 Example 2: Input: [9,6,4,2,3,5,7,0,1] O...原创 2018-11-13 23:01:33 · 134 阅读 · 0 评论 -
189.Rotate Array
Given an array, rotate the array to the right by k steps, where k is non-negative. Example 1: Input: [1,2,3,4,5,6,7] and k = 3 Output: [5,6,7,1,2,3,4] Explanation: rotate 1 steps to the right: [7,1...原创 2018-11-05 20:17:46 · 134 阅读 · 0 评论 -
181.Customers Who Never Order
Suppose that a website contains two tables, the Customers table and the Orders table. Write a SQL query to find all customers who never order anything. Table: Customers. +----+-------+ | Id | Name ...原创 2018-11-05 20:13:29 · 169 阅读 · 0 评论 -
181.Employees Earning More Than Their Managers
The Employee table holds all employees including their managers. Every employee has an Id, and there is also a column for the manager Id. +----+-------+--------+-----------+ | Id | Name | Salary | ...原创 2018-11-05 20:11:09 · 154 阅读 · 0 评论 -
176.Second Highest Salary
Write a SQL query to get the second highest salary from the Employee table. +----+--------+ | Id | Salary | +----+--------+ | 1 | 100 | | 2 | 200 | | 3 | 300 | +----+--------+ For exam...原创 2018-11-05 20:09:50 · 170 阅读 · 0 评论 -
175.Combine Two Tables
Table: Person +-------------+---------+ | Column Name | Type | +-------------+---------+ | PersonId | int | | FirstName | varchar | | LastName | varchar | +-------------+---------+ Pe...原创 2018-11-05 20:08:52 · 186 阅读 · 0 评论 -
172.factorial-trailing-zeroes
Given an integer n, return the number of trailing zeroes in n!. Example 1: Input: 3 Output: 0 Explanation: 3! = 6, no trailing zero. Example 2: Input: 5 Output: 1 Explanation: 5! = 120, one trai...原创 2018-11-05 19:36:19 · 295 阅读 · 0 评论 -
226.Invert Binary Tree
Invert a binary tree. Example: Input: 4 / \ 2 7 / \ / \ 1 3 6 9 Output: 4 / \ 7 2 / \ / \ 9 6 3 1 解题思路:用递归,一层一层交换 /** * @param {TreeNode} root ...原创 2018-11-06 19:13:45 · 143 阅读 · 0 评论 -
leetcode 4.两个排序数组的中位数
给定两个大小为 m 和 n 的有序数组 nums1 和 nums2 。请找出这两个有序数组的中位数。要求算法的时间复杂度为 O(log (m+n)) 。示例 1:nums1 = [1, 3] nums2 = [2] 中位数是 2.0 示例 2:nums1 = [1, 2] nums2 = [3, 4] 中位数是 (2 + 3)/2 = 2.5给定两个大小为 m 和 n 的有序数组 nums1 ...原创 2018-07-05 23:06:22 · 139 阅读 · 0 评论 -
3. Longest Substring Without Repeating Characters
Given a string, find the length of the longest substring without repeating characters. Example 1: Input: "abcabcbb" Output: 3 Explanation: The answer is "abc", with the length of 3. Example 2: ...原创 2018-07-04 23:59:21 · 129 阅读 · 0 评论 -
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 i...原创 2018-07-03 23:49:14 · 147 阅读 · 0 评论
分享