Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target…
分类:LeetCode
[LeetCode] Longest Repeating Character Replacement 最长重复字符置换
Given a string that consists of only uppercase English letters, you can replace any letter in the strin…
【leetcode】101. Symmetric Tree 二叉树是否是镜像结构
1. 题目 Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For examp…
364. Nested List Weight Sum II
Medium Given a nested list of integers, return the sum of all integers in the list weighted by their depth. Ea…
2018-05-15 70. Climbing Stairs
题意:爬楼梯,一次可以爬1阶或2阶,输入正数n,输出爬到n阶楼梯总共有几种策略。 解题思路: 方法一:动态规划DP,一次可以上1阶或2阶,那么到第n阶可以从第n-1阶上1阶,或者从n-2阶上2阶,所以到第n阶的策略等于到…
27. 移除元素
27. 移除元素 问题 给定一个数组 和一个值 ,你需要原地移除所有数值等于 的元素,返回移除后数组的新长度。 不要使用额外的数组空间,你必须在原地修改输入数组并在使用 额外空间的条件下完成。 元素的顺序可以改变。你不需…
CareerCup All in One 题目汇总
Chapter 1. Arrays and Strings 1.1 Unique Characters of a String 1.2 Reverse String 1.3 Permutation Stri…
[LeetCode] Valid Phone Numbers 验证电话号码
Given a text file file.txt that contains list of phone numbers (one per line), write a one liner bash s…
[LeetCode] Insert into a Binary Search Tree 二叉搜索树中插入结点
Given the root node of a binary search tree (BST) and a value to be inserted into the tree, insert…
[Leetcode] Rotate List 旋转链表
Rotate List Given a list, rotate the list to the right by k places, where k is non-negative. For example: Give…
【Leetcode】12. Integer to Roman 阿拉伯数字转罗马数字
1. 题目 Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 39…
[LeetCode][Python]13. Roman to Integer
Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. 思路…