Sara

  • Home

  • Tags

  • Categories

  • Archives

  • Search

LeetCode_Reorder List

Posted on 2019-03-15 | In LeetCode

Reorder List

Given a singly linked list L: L0→L1→…→Ln-1→Ln, reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You may not modify the values in the list’s nodes, only nodes itself may be changed.
(链表重新排序)

Read more »

LeetCode_Linked List Cycle II

Posted on 2019-03-15 | In LeetCode

Linked List Cycle II

Given a linked list, return the node where the cycle begins. If there is no cycle, return null. To represent a cycle in the given linked list, we use an integer pos which represents the position (0-indexed) in the linked list where tail connects to. If pos is -1, then there is no cycle in the linked list.
(链表中环的起点)

Read more »

LeetCode_Linked List Cycle

Posted on 2019-03-15 | In LeetCode

Linked List Cycle

Given a linked list, determine if it has a cycle in it. To represent a cycle in the given linked list, we use an integer pos which represents the position (0-indexed) in the linked list where tail connects to. If pos is -1, then there is no cycle in the linked list.
(链表有环)

Read more »

LeetCode_Word Break II

Posted on 2019-03-14 | In LeetCode

Word Break II

Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, add spaces in s to construct a sentence where each word is a valid dictionary word. Return all such possible sentences.
(字符串有效分词)

Read more »

LeetCode_Word Break

Posted on 2019-03-14 | In LeetCode

Word Break

Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, determine if s can be segmented into a space-separated sequence of one or more dictionary words.
(字符串是否可以有效分词)

Read more »

LeetCode_Copy List with Random Pointer

Posted on 2019-03-14 | In LeetCode

Copy List with Random Pointer

A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null. Return a deep copy of the list.
(深拷贝链表)

Read more »

LeetCode_Single Number II

Posted on 2019-03-14 | In LeetCode

Single Number II

Given a non-empty array of integers, every element appears three times except for one, which appears exactly once. Find that single one.
(只出现一次的数字(其余出现三次))

Read more »

LeetCode_Single Number

Posted on 2019-03-14 | In LeetCode

Single Number

Given a non-empty array of integers, every element appears twice except for one. Find that single one.
(只出现一次的数字(其余出现两次))

Read more »

LeetCode_Candy

Posted on 2019-03-14 | In LeetCode

Candy

There are N children standing in a line. Each child is assigned a rating value. You are giving candies to these children subjected to the following requirements:

  1. Each child must have at least one candy.
  2. Children with a higher rating get more candies than their neighbors.

What is the minimum candies you must give?
(分糖问题)

Read more »

LeetCode_Gas Station

Posted on 2019-03-14 | In LeetCode

Gas Station

There are N gas stations along a circular route, where the amount of gas at station i is gas[i]. You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from station i to its next station (i+1). You begin the journey with an empty tank at one of the gas stations. Return the starting gas station’s index if you can travel around the circuit once in the clockwise direction, otherwise return -1.
(加油站问题)

Read more »
1…678…21

Sara Han

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