随笔分类 -  leetcode

DO IT BEST
摘要:题目 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 s 阅读全文
posted @ 2017-08-01 14:18 lepeCoder 阅读(320) 评论(0) 推荐(0) 编辑
摘要:题目 Given a linked list, determine if it has a cycle in it. Follow up: Can you solve it without using extra space? 分析 判断链表是否有环,采用快慢指针,如果相遇则表示有环 AC代码 阅读全文
posted @ 2017-07-31 21:03 lepeCoder 阅读(236) 评论(0) 推荐(0) 编辑
摘要:题目 Given a linked list, return the node where the cycle begins. If there is no cycle, return null. Note: Do not modify the linked list. Follow up: Can 阅读全文
posted @ 2017-07-31 20:26 lepeCoder 阅读(257) 评论(0) 推荐(0) 编辑
摘要:原题 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. 阅读全文
posted @ 2017-07-31 18:04 lepeCoder 阅读(206) 评论(0) 推荐(0) 编辑
摘要:原题 Given a binary tree, return the preorder traversal of its nodes' values. 分析 对二叉树进行先序遍历,即根节点 左子树 右子树 代码: 递归: 递归代码十分简单,建立一个vector作为返回的结果,现将根节点push进去, 阅读全文
posted @ 2017-07-30 22:15 lepeCoder 阅读(335) 评论(0) 推荐(0) 编辑
摘要:__描述:__ Given a binary tree, return the postorder traversal of its nodes' values. 直接递归,按照 左子树 右子树 头结点的顺序 AC代码: 阅读全文
posted @ 2017-07-30 21:21 lepeCoder 阅读(275) 评论(0) 推荐(0) 编辑
摘要:__描述:__ Sort a linked list using insertion sort. 使用插入排序对一个链表进行排序 普通的插入排序,时间复杂度O(n^2) 阅读全文
posted @ 2017-07-30 13:12 lepeCoder 阅读(272) 评论(0) 推荐(0) 编辑
摘要:Sort a linked list in O(n log n) time using constant space complexity. 阅读全文
posted @ 2017-07-30 03:00 lepeCoder 阅读(364) 评论(0) 推荐(0) 编辑
摘要:Description: Given a string, find the length of the longest substring without repeating characters. 查找最长的不重复子字符串 Examples:Given "abcabcbb... 阅读全文
posted @ 2017-07-18 23:19 lepeCoder 阅读(216) 评论(0) 推荐(0) 编辑
摘要:题目: Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are +, -, *, /. Each operand may be an integ... 阅读全文
posted @ 2017-07-17 00:33 lepeCoder 阅读(246) 评论(0) 推荐(0) 编辑
摘要:题目: Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down t... 阅读全文
posted @ 2017-07-16 22:48 lepeCoder 阅读(157) 评论(0) 推荐(0) 编辑
摘要:原题: You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their... 阅读全文
posted @ 2017-07-09 20:43 lepeCoder 阅读(168) 评论(0) 推荐(0) 编辑
摘要:题目: Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each inpu... 阅读全文
posted @ 2017-07-09 12:15 lepeCoder 阅读(164) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示