Write a program that outputs the string representation of numbers from 1 to n. But for multiples of three it s…
分类:LeetCode
[Leetcode] Add Two Numbers 链表数相加
Add Two Numbers You are given two linked lists representing two non-negative numbers. The digits are stored in…
LeetCode | Remove Element(删除指定元素)
Given an array and a value, remove all instances of that value in place and return the new length. The order o…
LeetCode | Reverse Integer(翻转整数)
题目: Reverse digits of an integer. Example1: x = 123, return 321Example2: x = -123, return -321 click…
二叉树的后序遍历
题目: 输入一个整数数组,判断该数组是不是某二叉搜索树的后序遍历的结果。如果是则输出Yes,否则输出No。假设输入的数组的任意两个数字都互不相同。 方法分析: BST的后序序列的合法序列是,对于一个序列S,最后一个元素是…
Leetcode PHP题解--D26 766. Toeplitz Matrix
766. Toeplitz Matrix 题目链接 766. Toeplitz Matrix 题目分析 拓普利兹矩阵,应该不用多说了。 要求自己的右下和左上元素值相等。 思路 拿当前行的前0n-1位,与下一行的1n位对比…
LeetCode : 字符串的排列
字符串的排列 题目叙述: 给定两个字符串 s1 和 s2,写一个函数来判断 s2 是否包含 s1 的排列。 换句话说,第一个字符串的排列之一是第二个字符串的子串。 示例: 示例1: 输入: s1 = “ab&…
132. Palindrome Partitioning II
欢迎fork and star:Nowcoder-Repository-github 132. Palindrome Partitioning II 题目 Given a string s, partition s su…
[LeetCode] Walls and Gates 墙和门
You are given a m x n 2D grid initialized with these three possible values. -1 – A wall or an obs…
LeetCode | Length of Last Word
题目: Given a string s consists of upper/lower-case alphabets and empty space characters ' ', ret…
217. Contains Duplicate
Given an array of integers, find if the array contains any duplicates.Your function should return true if any …
[Leetcode] Longest Valid Parentheses 最长有效括号对
Longest Valid Parentheses Given a string containing just the characters ‘(‘ and ‘)’, f…