
算法题
文章平均质量分 66
Peggy_Chang
人工智能挖坑者
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
[Leetcode] 283. Move Zeroes
Description: Given an array nums, write a function to move all 0’s to the end of it while maintaining the relative order of the non-zero elements.原创 2018-03-07 10:03:17 · 224 阅读 · 0 评论 -
[Leetcode] 125. Valid Palindrome
Description: Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example, “A man, a plan, a canal: Panama” is a palindrome. “race a ca...原创 2018-03-13 23:53:15 · 217 阅读 · 0 评论 -
[Leetcode] 215. Kth Largest Element in an Array
Description: Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.For example, Given [3,2,1,5,6,4] and k = 2...原创 2018-03-05 19:14:14 · 193 阅读 · 0 评论 -
[Leetcode] 454. 4Sum II
Description: Given four lists A, B, C, D of integer values, compute how many tuples (i, j, k, l) there are such that A[i] + B[j] + C[k] + D[l] is zero.To make problem a bit easier, all A, B, C, D h...原创 2018-03-18 21:23:06 · 341 阅读 · 0 评论 -
[Leetcode] 350. Intersection of Two Arrays II
Description: Given two arrays, write a function to compute their intersection.Example: Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2, 2].Note: Each element in the result should appear a...原创 2018-03-18 20:45:41 · 315 阅读 · 0 评论 -
[Leetcode] 349. Intersection of Two Arrays
Description: Given two arrays, write a function to compute their intersection.Example: Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2].Note: Each element in the result must be unique. T...原创 2018-03-18 20:33:07 · 236 阅读 · 0 评论 -
[Leetcode] 88. Merge Sorted Array
Description: Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note: You may assume that nums1 has enough space (size that is greater or equal to m + n) t...原创 2018-03-12 11:07:35 · 404 阅读 · 0 评论 -
[Leetcode] 75. Sort Colors
Description: Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.Here, we will use t...原创 2018-03-11 21:00:16 · 223 阅读 · 0 评论 -
[Leetcode] 771. Jewels and Stones
Description: You’re given strings J representing the types of stones that are jewels, and S representing the stones you have. Each character in S is a type of stone you have. You want to know how m...原创 2018-02-23 23:47:38 · 391 阅读 · 0 评论 -
[Leetcode]144, 94, 145二叉树前中后序遍历的非递归实现
144. Binary Tree Preorder TraversalDescription: Given a binary tree, return the preorder traversal of its nodes’ values.For example: Given binary tree [1,null,2,3], 1 \ 2 / ...原创 2018-03-17 14:26:20 · 321 阅读 · 0 评论 -
[Leetcode] 80. Remove Duplicates from Sorted Array II
Description: Follow up for “Remove Duplicates”: What if duplicates are allowed at most twice? 由于follow up Problem 26,因此还是要求in-place。Example: Given sorted array nums = [1,1,1,2,2,3], 仍旧是排好序的数组 ...原创 2018-03-11 10:46:16 · 188 阅读 · 0 评论 -
[Leetcode] 26. Remove Duplicates from Sorted Array
Description: Given a sorted array, remove the duplicates in-place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this b...原创 2018-03-11 00:36:05 · 178 阅读 · 0 评论 -
[Leetcode] 27. Remove Element
Description: Given an array and a value, remove all instances of that value in-place and return the new length.Do not allocate extra space for another array, you must do this by modifying the input...原创 2018-03-10 17:13:26 · 197 阅读 · 0 评论 -
[Leetcode] 11. Container With Most Water
Description: Given n non-negative integers a1, a2, …, an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0...原创 2018-03-15 09:17:51 · 267 阅读 · 0 评论 -
[Leetcode] 167. Two Sum II - Input array is sorted
Description: Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.The function twoSum should return indices of th...原创 2018-03-08 09:08:48 · 182 阅读 · 0 评论 -
[Leetcode] 344. Reverse String
Description: Write a function that takes a string as input and returns the string reversed.Example: Given s = “hello”, return “olleh”.考虑空字符串,也属于reversed string.解法一: 基本思想:对撞指针。 思路:从头从尾分别同时遍历,...原创 2018-03-14 09:56:38 · 218 阅读 · 0 评论