LeetCode 之 JavaScript 解答第112题 —— 路径总和(Path Sum)

2019-05-10
阅读 2 分钟
2.2k
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.

LeetCode 之 JavaScript 解答第94题 —— 二叉树的中序遍历

2019-05-06
阅读 2 分钟
3.5k
Time:2019/4/25Title:Binary Tree Inorder TraversalDifficulty: MediumAuthor:小鹿

LeetCode 之 JavaScript 解答第98题 —— 验证二叉搜索树

2019-04-29
阅读 2 分钟
2.6k
Time:2019/4/24Title: Vaildata Binary Search TreeDifficulty: MediumAuthor: 小鹿

LeetCode 之 JavaScript 解答第206题 —— 反转链表(Reverse Linked List)

2019-04-29
阅读 2 分钟
1.7k
Time:2019/4/23Title: Reverse Linked ListDifficulty: EasyAuthor: 小鹿 题目:Reverse Linked List(反转链表) Reverse a singly linked list. Example: {代码...} Follow up: A linked list can be reversed either iteratively or recursively. Could you implement both? Solve: ▉ 问题分析 1)反转链表的我们第...

LeetCode 之 JavaScript 解答第104题 —— 二叉树的最大深度

2019-04-25
阅读 1 分钟
2.1k
Time:2019/4/22Title: Maximum Depth of Binary TreeDifficulty: MediumAuthor:小鹿

LeetCode 之 JavaScript 解答第226题 —— 翻转二叉树(Invert Binary Tree)

2019-04-24
阅读 1 分钟
1.7k
Time:2019/4/21Title: Invert Binary TreeDifficulty: EasyAuthor: 小鹿 题目:Invert Binary Tree(反转二叉树) Invert a binary tree. 反转二叉树 Example: Input: {代码...} Output: {代码...} Solve: ▉ 问题分析 由上图可以分析反转二叉树,只是对左右子树的数据进行交换,再仔细观察,并不是每个节点的左右子树进...

LeetCode 之 JavaScript 解答第151题 —— 反转字符串中的单词

2019-04-22
阅读 2 分钟
2.4k
Time:2019/4/20Title: Reverse Words In a StringDifficulty: MidumnAuthor: 小鹿

LeetCode 之 JavaScript 解答第8题 —— 字符串转换整数 (String to Integer )

2019-04-21
阅读 4 分钟
2.3k
The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical digits as possible, and interprets them as a numerical value.

LeetCode 之 JavaScript 解答第344题 —— 反转字符串(Reverse String)

2019-04-21
阅读 2 分钟
3k
Write a function that reverses a string. The input string is given as an array of characters char[].

LeetCode 之 JavaScript 解答第69题 —— X 的平方根(Squrt(x))

2019-04-19
阅读 2 分钟
2.6k
Compute and return the square root of x, where x is guaranteed to be a non-negative integer.

LeetCode 之 JavaScript 解答第239题 —— 滑动窗口最大值(Sliding Window Maximum)

2019-04-17
阅读 4 分钟
2.1k
Time:2019/4/16Title: Sliding Window MaximumDifficulty: DifficultyAuthor: 小鹿

LeetCode 之 JavaScript 解答第641题 —— 设计双端队列(Design Circular Deque)

2019-04-17
阅读 6 分钟
1.7k
Time:2019/4/15Title: Design Circular DequeDifficulty: MediumAuthor: 小鹿

LeetCode 之 JavaScript 解答第150题 —— 逆波兰表达式求值

2019-04-15
阅读 3 分钟
2.3k
Time:2019/4/14Title: Evaluate Reverse Polish NotationDifficulty: MediumAuthor:小鹿

LeetCode 之 JavaScript 解答第70题 —— 爬楼梯(Climbing Stairs)

2019-04-14
阅读 2 分钟
2.6k
Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?

LeetCode 之 JavaScript 解答第20题 —— 有效的括号(Valid Parentheses)

2019-04-12
阅读 3 分钟
3.2k
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.

LeetCode 之 JavaScript 解答第23题 —— 合并K个有序链表(Merge K Sorted Lists)

2019-04-11
阅读 2 分钟
2.1k
Time:2019/4/10Title: Merge K Sorted ListsDifficulty: DifficultyAuthor: 小鹿

LeetCode 之 JavaScript 解答第21题 —— 合并两个有序链表(Merge Two Sorted Lists)

2019-04-10
阅读 2 分钟
2.3k
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.

LeetCode 之 JavaScript 解答第142题 —— 环形链表 II(Linked List Cycle II)

2019-04-09
阅读 3 分钟
1.6k
Given a linked list, return the node where the cycle begins. If there is no cycle, return null.

LeetCode 之 JavaScript 解答第141题 —— 环形链表 I(Linked List Cycle I)

2019-04-09
阅读 3 分钟
1.7k
To represent a cycle in the given linked list, we use an integer pos which represents the position (0-indexed) in the linked list where tail connects to. If pos is -1, then there is no cycle in the linked list.

LeetCode 之 JavaScript 解答第41题 —— 缺失的第一个正数(First Missing Positive)

2019-04-07
阅读 2 分钟
1.9k
Time:2019/4/6Title: First Missing PositiveDifficulty: DifficultyAuthor: 小鹿

LeetCode 之 JavaScript 解答第229题 —— 求众数 II(Majority Element)

2019-04-05
阅读 3 分钟
1.5k
Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times.

LeetCode 之 JavaScript 解答第169题 —— 求众数 I(Majority Element)

2019-04-05
阅读 2 分钟
2k
Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋times.

LeetCode 之 JavaScript 解答第十五题 —— 三数之和(3Sum)

2019-04-04
阅读 3 分钟
2.6k
Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.

LeetCode 之 JavaScript 解答第二题 —— 两数相加(Add Two Numbers)

2019-04-03
阅读 4 分钟
2.5k
Time:2019/4/2Title: ADD Two NumbersDifficulty: mediumAuthor:小鹿公众号:一个不甘平凡的码农。

LeetCode 之 JavaScript 解答第一题 —— 两数之和(Two Sum)

2019-04-03
阅读 3 分钟
1.4k
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 element twice.