# CODE 147: Evaluate Reverse Polish Notation

Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are +, -, *, /. Each operand may be an integer or another expression. Some examples: ["2", "1", "+",...

# CODE 146: Max Points on a Line

Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. public int maxPoints(Point[] points) { // IMPORTANT: Please reset any member data you declared...

# CODE 144: Insertion Sort List

Sort a linked list using insertion sort. public ListNode insertionSortList(ListNode head) { // IMPORTANT: Please reset any member data you declared, as // the same Solution instance will be reus...

# CODE 145: Sort List

Sort a linked list in O(n log n) time using constant space complexity. public ListNode sortList(ListNode head) { // IMPORTANT: Please reset any member data you declared, as // the same Solutio...

# CODE 143:LRU Cache

Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set. get(key) - Get the value (will always be positive) of the key if...

# CODE 142: Binary Tree Postorder Traversal

Given a binary tree, return the postorder traversal of its nodes' values. For example: Given binary tree {1,#,2,3}, 1 \ 2 / 3 return [3,2,1]. public ArrayList pos...

# CODE 141: Binary Tree Preorder Traversal

Given a binary tree, return the preorder traversal of its nodes' values. For example: Given binary tree {1,#,2,3}, 1 \ 2 / 3 return [1,2,3]. Note: Recursive soluti...

# CODE 140: 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 must do this in-place without altering the nodes' values. For example, Given {1,2,3,4}, reorder it to {1,4...

# CODE 139: Linked List Cycle II

Given a linked list, return the node where the cycle begins. If there is no cycle, return null. Follow up: Can you solve it without using extra space? 点击打开链接 public ListNode detectCycle(ListNod...

# CODE 138: Linked List Cycle

Given a linked list, determine if it has a cycle in it. Follow up: Can you solve it without using extra space? public boolean hasCycle(ListNode head) { // IMPORTANT: Please reset any...

# CODE 137: Word Break II

Given a string s and a dictionary of words dict, add spaces in s to construct a sentence where each word is a valid dictionary word. Return all such possible sentences. For example, given s = "...

# CODE 136: Word Break

Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words. For example, given s = "leetcode", dict = ["leet"...

# CODE 135: 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. public RandomListNode copyRan...

# CODE 134: Single Number II

Given an array of integers, every element appears three times except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it without usi...

# CODE 133: Single Number

Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it without using ext...

# CODE 132: 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: Each child must have at least on...

# CODE 131: 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 ...

# CODE 6: Word Ladder II

Given two words (start and end), and a dictionary, find all shortest transformation sequence(s) from start to end, such that: Only one letter can be changed at a timeEach intermediate word must exi...

# CODE 130: Clone Graph

Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors. OJ's undirected graph serialization: Nodes are labeled uniquely. We use # as a separator for ea...

54条 共3页1 2 3 下一页 尾页
个人资料
• 访问：105600次
• 积分：2773
• 等级：
• 排名：第14304名
• 原创：178篇
• 转载：21篇
• 译文：0篇
• 评论：9条
文章分类
阅读排行
评论排行
最新评论