Sara

  • Home

  • Tags

  • Categories

  • Archives

  • Search

LeetCode_Search in Rotated Sorted Array

Posted on 2018-12-21 | In LeetCode

Search in Rotated Sorted Array

Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]). You are given a target value to search. If found in the array return its index, otherwise return -1. You may assume no duplicate exists in the array. Your algorithm’s runtime complexity must be in the order of O(log n).
(在时间复杂度为O(log n)的前提下在经旋转的有序数组中检索)

Read more »

LeetCode_Longest Valid Parentheses

Posted on 2018-12-21 | In LeetCode

Longest Valid Parentheses

Given a string containing just the characters ‘(‘ and ‘)’, find the length of the longest valid (well-formed) parentheses substring.
(最长有效括号对)

Read more »

LeetCode_Next Permutation

Posted on 2018-12-21 | In LeetCode

Next Permutation

Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possible, it must rearrange it as the lowest possible order (ie, sorted in ascending order). The replacement must be in-place and use only constant extra memory.
(从小到大全排列的下一个)

Read more »

LeetCode_Substring with Concatenation of All Words

Posted on 2018-12-18 | In LeetCode

Substring with Concatenation of All Words

You are given a string s, and a list of words words, that are all of the same length. Find all starting indices of substring(s) in s that is a concatenation of each word in words exactly once and without any intervening characters.
(找到字符串中所有的子串,其为字符串数组全排列形成)

Read more »

LeetCode_Divide Two Integers

Posted on 2018-12-18 | In LeetCode

Divide Two Integers

Given two integers dividend and divisor, divide two integers without using multiplication, division and mod operator. Return the quotient after dividing dividend by divisor. The integer division should truncate toward zero.
(非乘 除 取模 方法实现除法)

Read more »

LeetCode_Implement strStr()

Posted on 2018-12-18 | In LeetCode

Implement strStr()

Implement strStr(). Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.
(实现寻找字符串子串函数)

Read more »

LeetCode_Remove Element

Posted on 2018-12-18 | In LeetCode

Remove Element

Given an array nums and a value val, 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 array in-place with O(1) extra memory. The order of elements can be changed. It doesn’t matter what you leave beyond the new length.
(删除数组中特定元素,限制空间复杂度)

Read more »

LeetCode_Remove Duplicates from Sorted Array

Posted on 2018-12-18 | In LeetCode

Remove Duplicates from Sorted Array

Given a sorted array nums, 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 by modifying the input array in-place with O(1) extra memory.
(删除数组中重复的元素,限制空间复杂度)

Read more »

LeetCode_Reverse Nodes in k-Group

Posted on 2018-12-18 | In LeetCode

Reverse Nodes in k-Group

Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. k is a positive integer and is less than or equal to the length of the linked list. If the number of nodes is not a multiple of k then left-out nodes in the end should remain as it is.
(链表分组倒排)

Note:

  • Only constant extra memory is allowed.
  • You may not alter the values in the list’s nodes, only nodes itself may be changed.
Read more »

LeetCode_Swap Nodes in Pairs

Posted on 2018-12-13 | Edited on 2018-12-26 | In LeetCode

Swap Nodes in Pairs

Given a linked list, swap every two adjacent nodes and return its head.
(交换链表中相邻的两个值)

Read more »
1…171819…21

Sara Han

207 posts
4 categories
40 tags
© 2019 Sara Han
Powered by Hexo v3.8.0
|
Theme – NexT.Mist v6.4.2