Given two arrays, write a function to compute their intersection. Example:Given nums1 = [1, 2, 2, 1] , nums2 =…
分类:LeetCode
LeetCode653. Two Sum IV - Input is a BST
The simplest solution for this question is probably get all the value out into an array and solve it just like…
[剑指offer] 序列化二叉树
本文首发于我的个人博客:尾尾部落 题目描述 请实现两个函数,分别用来序列化和反序列化二叉树 解题思路 对于序列化:使用前序遍历,递归的将二叉树的值转化为字符,并且在每次二叉树的结点不为空时,在转化val所得的字符之后添加…
806. Number of Lines To Write String
题目地址:https://leetcode.com/problems/number-of-lines-to-write-string/description/ 大意:给定一个字符串,让他们分行书写,每个字符串长度给定,当…
[剑指offer] 丑数
本文首发于我的个人博客:尾尾部落 题目描述 把只包含质因子2、3和5的数称作丑数(Ugly Number)。例如6、8都是丑数,但14不是,因为它包含质因子7。 习惯上我们把1当做是第一个丑数。求按从小到大的顺序的第N个…
Day2. Two Sum(1)
问题描述 Given an array of integers, return indices of the two numbers such that they add up to a specific target.…
LeetCode | Spiral Matrix II(螺旋矩阵填充数据)
Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.…
[LeetCode][Search] 296. Best Meeting Point
Problem More LeetCode Discussions A group of two or more people wants to meet and minimize the total travel di…
LeetCode算法题-Next Greater Element I(Java实现)
这是悦乐书的第244次更新,第257篇原创 01 看题和准备 今天介绍的是LeetCode算法题中Easy级别的第111题(顺位题号是496)。你有两个数组(没有重复)nums1和nums2,其中nums1的元素是num…
leetcode-150. Evaluate Reverse Polish Notation
题目描述 Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are +, -, *, /…
[LeetCode] Sum of Two Integers 两数之和
Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -. Example…
[LeetCode] Shortest Unsorted Continuous Subarray 最短无序连续子数组
Given an integer array, you need to find one continuous subarray that if you only sort this s…