摘要:
Linked List CycleGiven a linked list, determine if it has a cycle in it.c++/** * Definition for singly-linked list. * struct ListNode { * int val;... 阅读全文
摘要:
Single NumberGiven an array of integers, every element appearstwiceexcept for one. Find that single one.c++版:class Solution {public: int singleNumbe... 阅读全文
摘要:
Binary Tree Preorder TraversalGiven a binary tree, return thepreordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ ... 阅读全文
摘要:
Max Points on a LineGivennpoints on a 2D plane, find the maximum number of points that lie on the same straight line.c++版本:/** * Definition for a poi... 阅读全文
摘要:
Evaluate Reverse Polish NotationValid operators are+,-,*,/. Each operand may be an integer or another expression.Some examples: ["2", "1", "+", "3", ... 阅读全文
摘要:
Reverse Words in a StringGiven an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".c++版:... 阅读全文