上一页 1 ··· 16 17 18 19 20 21 22 23 24 ··· 30 下一页

2017年12月22日

add two numbers(将两个链表相加)

摘要: You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contai 阅读全文

posted @ 2017-12-22 16:56 夜的第八章 阅读(173) 评论(0) 推荐(0) 编辑

majority element(数组中找出出现次数最多的元素)

摘要: Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the 阅读全文

posted @ 2017-12-22 14:45 夜的第八章 阅读(1309) 评论(0) 推荐(0) 编辑

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: 求两个链表开始重合的地 阅读全文

posted @ 2017-12-22 13:42 夜的第八章 阅读(136) 评论(0) 推荐(0) 编辑

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() -- Remov 阅读全文

posted @ 2017-12-22 10:51 夜的第八章 阅读(145) 评论(0) 推荐(0) 编辑

2017年12月21日

valid palindrome(回文)

摘要: Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example,"A man, a plan, a canal: Pan 阅读全文

posted @ 2017-12-21 20:09 夜的第八章 阅读(130) 评论(0) 推荐(0) 编辑

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 阅读全文

posted @ 2017-12-21 19:12 夜的第八章 阅读(155) 评论(0) 推荐(0) 编辑

Best Time to Buy and Sell Stock i

摘要: Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction 阅读全文

posted @ 2017-12-21 16:49 夜的第八章 阅读(132) 评论(0) 推荐(0) 编辑

Pascal's Triangle II

摘要: Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3,Return [1,3,3,1]. Note:Could you optimize your algorithm to us 阅读全文

posted @ 2017-12-21 16:29 夜的第八章 阅读(108) 评论(0) 推荐(0) 编辑

Pascal's Triangle(杨辉三角)

摘要: Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5,Return 思路:动态规划,前面的构建出来了,后面根据某种关系也就可以构建出来。 这个要根据前一行来构建下一 阅读全文

posted @ 2017-12-21 15:28 夜的第八章 阅读(209) 评论(2) 推荐(0) 编辑

path sum

摘要: Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. F 阅读全文

posted @ 2017-12-21 14:27 夜的第八章 阅读(139) 评论(0) 推荐(0) 编辑

上一页 1 ··· 16 17 18 19 20 21 22 23 24 ··· 30 下一页

导航