Sara

  • Home

  • Tags

  • Categories

  • Archives

  • Search

Algorithm_KMP

Posted on 2019-04-03 | Edited on 2019-08-20 | In Algorithm

KMP(Knuth-Morris-Pratt 字符串子串位置)

Read more »

LeetCode_Excel Sheet Column Title

Posted on 2019-04-02 | In LeetCode

Excel Sheet Column Title

Given a positive integer, return its corresponding column title as appear in an Excel sheet.
(将数值转换成EXCEL表格中的列名称)

Read more »

LeetCode_Two Sum II

Posted on 2019-04-02 | In LeetCode

Two Sum II

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 the two numbers such that they add up to the target, where index1 must be less than index2.
(一个升序数组中某两个元素的和为给定值)

Read more »

LeetCode_Fraction to Recurring Decimal

Posted on 2019-04-02 | In LeetCode

Fraction to Recurring Decimal

Given two integers representing the numerator and denominator of a fraction, return the fraction in string format. If the fractional part is repeating, enclose the repeating part in parentheses.
(分数->小数)

Read more »

LeetCode_Compare Version Numbers

Posted on 2019-03-25 | In LeetCode

Compare Version Numbers

Compare two version numbers version1 and version2. If version1 > version2 return 1; if version1 < version2 return -1; otherwise return 0. You may assume that the version strings are non-empty and contain only digits and the . character. The . character does not represent a decimal point and is used to separate number sequences.

For instance, 2.5 is not “two and a half” or “half way to version three”, it is the fifth second-level revision of the second first-level revision. You may assume the default revision number for each level of a version number to be 0. For example, version number 3.4 has a revision number of 3 and 4 for its first and second level revision number. Its third and fourth level revision number are both 0.
(比较’.’分开的数值大小)

Read more »

LeetCode_Maximum Gap

Posted on 2019-03-25 | In LeetCode

Maximum Gap

Given an unsorted array, find the maximum difference between the successive elements in its sorted form. Return 0 if the array contains less than 2 elements.
(乱序数组的排序后相邻元素差最大值)

Read more »

LeetCode_Find Peak Element

Posted on 2019-03-23 | In LeetCode

Find Peak Element

A peak element is an element that is greater than its neighbors. sGiven an input array nums, where nums[i] ≠ nums[i+1], find a peak element and return its index. The array may contain multiple peaks, in that case return the index to any one of the peaks is fine. You may imagine that nums[-1] = nums[n] = -∞.
(找到数组中的“波峰”值的index,一个即可。要求时间复杂度为O(logn))

Read more »

LeetCode_Intersection of Two Linked Lists

Posted on 2019-03-23 | In LeetCode

Intersection of Two Linked Lists

Write a program to find the node at which the intersection of two singly linked lists begins. For example, the following two linked lists:
(两个链表相交的结点)

Read more »

LeetCode_Min Stack

Posted on 2019-03-17 | In LeetCode

Min Stack

Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.

  • push(x) – Push element x onto stack.
  • pop() – Removes the element on top of the stack.
  • top() – Get the top element.
  • getMin() – Retrieve the minimum element in the stack.

(设计一个堆栈类,并可以O(1)定位到最小值)

Read more »

LeetCode_Find Minimum in Rotated Sorted Array II

Posted on 2019-03-17 | Edited on 2019-03-19 | In LeetCode

Find Minimum in Rotated Sorted Array II

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]). Find the minimum element. The array may contain duplicates.
(确定一个升序序列经过某个位置翻转后的数组的最小值(有重复元素))

Read more »
1…456…21

Sara Han

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