LeetCode-Easy类
今天好好优秀了么
Fake it until you make it.
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
205. Isomorphic Strings【LeetCode】
题目 Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the characters in s can be replaced to get t. All occurrences of a character must be replaced with anoth...原创 2019-03-25 23:31:12 · 136 阅读 · 0 评论 -
257. Binary Tree Paths 【LeetCode】
题目描述 Input: 1 / 2 3 \ 5 Output: [“1->2->5”, “1->3”] Explanation: All root-to-leaf paths are: 1->2->5, 1->3 解题思路: 利用递归,分为三步,输出val,输出左子树,输出右子树。 要到的问题 不知道怎么把数字转换成字符串,尝试过stre...原创 2019-03-30 20:24:39 · 159 阅读 · 0 评论 -
219. Contains Duplicate II【LeetCode】
问题描述 Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the absolute difference between i and j is at mos...原创 2019-03-26 19:20:01 · 115 阅读 · 0 评论 -
290. Word Pattern 【LeetCode】
题目描述 Given a pattern and a string str, find if str follows the same pattern. Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty word in str. I...原创 2019-03-31 13:19:51 · 212 阅读 · 0 评论 -
345. Reverse Vowels of a String 【LeetCode】
题目描述 Write a function that takes a string as input and reverse only the vowels of a string. Example 1: Input: “hello” Output: “holle” Example 2: Input: “leetcode” Output: “leotcede” 刚开始暴力双重循环,然后超时 c...原创 2019-04-01 20:17:51 · 135 阅读 · 0 评论 -
349. Intersection of Two Arrays【LeetCode】
问题描述 当作回顾一下set的用法吧。 set的常用方法: begin() 返回set容器的第一个迭代器 end() 返回set容器的最后一个迭代器 clear() 删除set容器中的所有的元素 empty() 判断set容器是否为空 max_size() 返回set容器可能包含的元素最大个数 size() 返回当前set容器中的元素...原创 2019-04-01 20:40:51 · 148 阅读 · 0 评论 -
350. Intersection of Two Arrays II 【LeetCode】
题目描述 注:vector没有find函数!!! 代码如下: class Solution { public: vector<int> intersect(vector<int>& nums1, vector<int>& nums2) { vector<int> v; sort(nums1.b...原创 2019-04-01 21:17:53 · 183 阅读 · 0 评论 -
234. Palindrome Linked List【LeetCode】
问题描述 Given a singly linked list, determine if it is a palindrome. Example 1: Input: 1->2 Output: false Example 2: Input: 1->2->2->1 Output: true Follow up: Could you do it in O(n) time...原创 2019-03-29 13:53:28 · 183 阅读 · 0 评论
分享