
c#
qufayudao
这个作者很懒,什么都没留下…
展开
-
LeetCode 137. Single Number II
描述 Given an array of integers, every element appears three times except for one, which appears exactly once. Find that single one. Note: Your algorithm should have a linear runtime complexity. Co...原创 2018-03-17 21:53:24 · 183 阅读 · 0 评论 -
139. Word Break
描述 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 sequence of one or more dictionary words. You may...原创 2018-03-18 14:38:30 · 200 阅读 · 0 评论 -
LeetCode 142. Linked List Cycle II
描述 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 you solve it without using extra space? 思...原创 2018-03-18 15:50:50 · 292 阅读 · 0 评论 -
LeetCode 144. Binary Tree Preorder Traversal
描述 Given a binary tree, return the preorder traversal of its nodes’ values. For example: Given binary tree [1,null,2,3], 1 \ 2 / 3 return [1,2,3]. Note: Recursive solution i...原创 2018-03-22 22:13:13 · 179 阅读 · 0 评论 -
LeetCode 143. 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 t...原创 2018-03-22 15:11:25 · 154 阅读 · 0 评论 -
LeetCode 147. Insertion Sort List
描述 Sort a linked list using insertion sort. 思路 首先要明白直接插入排序的概念:遍历一个数组,当找到一个数a,该数比前一个数更小,则将a之前的所有大于a的数全部向前移动1,将a插入最后一个大于该数的位置。用数组排序的代码如下 代码(c#) public void InsertSort(int[] arr) { ...原创 2018-03-22 23:56:56 · 124 阅读 · 0 评论 -
LeetCode 150. 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", "+...原创 2018-03-23 18:17:16 · 173 阅读 · 0 评论