leetcode
HIT-Lori
一名刚入职的程序媛
展开
-
(leetcode)Evaluate Reverse Polish Notation
Question: 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:原创 2014-04-14 09:59:40 · 1033 阅读 · 0 评论 -
Add Two Numbers
class Solution { public: ListNode *addTwoNumbers(ListNode *l1, ListNode *l2) { ListNode* phead =new ListNode(0); ListNode* pTail =phead; //int *temp ; int carry = 0; if(!l原创 2014-04-30 17:06:15 · 742 阅读 · 0 评论 -
(leetcode)Max Points on a Line
Question: Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. 分析: 1、二维空间的任何一条线都可以表示成为y= k x + b 的形式。两点确定一条直线。固定其中一个点,遍历其余的点,斜率一致的即共线。 2、求斜率时原创 2014-04-15 16:29:29 · 850 阅读 · 0 评论 -
(leetcode) Two Sum
Question: Given an array of integers, 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 th原创 2014-04-23 14:49:00 · 846 阅读 · 0 评论 -
(leetcode)Median of Two Sorted Arrays
Question: There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). code : class So原创 2014-04-23 17:23:12 · 771 阅读 · 0 评论 -
(leetcode) Longest Substring Without Repeating Characters
Question : Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the len原创 2014-04-25 10:41:29 · 699 阅读 · 0 评论 -
(LeetCode) Reverse Words in a String
problem :Reverse Words in a String Given an input string, reverse the string word by word. For example, Given s = "the sky is blue", return "blue is sky the".原创 2014-04-13 09:26:54 · 8688 阅读 · 3 评论