自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

nudt_oys的博客

欢迎访问个人网站:https://www.cnblogs.com/littleorange/

  • 博客(20)
  • 收藏
  • 关注

原创 LeetCode 1 Two Sum

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 input would have exactly one solution, and you may not use the same 

2017-05-31 18:30:28 510

原创 LeetCode 507 Perfect Number(完美数字)

We define the Perfect Number is a positive integer that is equal to the sum of all its positive divisors except itself.Now, given an integer n, write a function that returns true when it is a perfec

2017-05-29 14:57:34 2435

原创 LeetCode 145 Binary Tree Postorder Traversal(二叉树后序遍历)

Given a binary tree, return the postorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [3,2,1].Note: Recursive solution is t

2017-05-28 09:56:05 609

原创 LeetCode 144 Binary Tree Preorder Traversal(二叉树前序遍历)

Given a binary tree, return the preorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,2,3].Note: Recursive solution is tr

2017-05-28 09:48:56 657

原创 LeetCode 94 Binary Tree Inorder Traversal(二叉树中序遍历)

Given a binary tree, return the inorder traversal of its nodes' values.For example:Given binary tree [1,null,2,3], 1 \ 2 / 3return [1,3,2].Note: Recursive solution is

2017-05-28 09:29:13 817

原创 LeetCode 450 Delete Node in a BST(删除BST节点)

Given a root node reference of a BST and a key, delete the node with the given key in the BST. Return the root node reference (possibly updated) of the BST.Basically, the deletion can be divided int

2017-05-24 16:12:37 583

原创 C语言宏定义小结

在C语言中,宏定义的形式如下: #define name replacement-text  这是最简单的一种宏替换——后续所有出现name的地方都会被替换成replacement-text。#define指令中的name与普通变量名的命名方式相同,而replacement-text可以是任意的字符串。如果一个宏定义比较长,可以在待续行的末尾加上一个反斜杠\。就像下面这样: #defi

2017-05-22 23:04:49 504

原创 LeetCode 23 Merge k Sorted Lists(归并)

Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.题目大意:合并k个有序链表并分析时间复杂度。解题思路:每两个链表进行一次合并,再对合并好的链表重复上述过程。k个链表需要合并O(k)次,每次合并需要O(n)的时间,所以总的时间复杂度为O(kn)。

2017-05-19 22:00:41 944

原创 LeetCode 160 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:A: a1 → a2 ↘

2017-05-19 17:09:29 656

原创 LeetCode 111 Minimum Depth of Binary Tree(DFS)

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 to the nearest leaf node.题目大意:给出一个二叉树,求从根节点到叶节点的最小深度。解题思路:直接D

2017-05-19 11:10:55 637

原创 LeetCode 104 Maximum Depth of Binary Tree(DFS)

Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.题目大意:求二叉树的最大深度。解题思路:没啥好说的,直接DFS求解。

2017-05-19 10:49:13 796

原创 LeetCode 28 Implement strStr()(子字符串查找)

Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.题目大意:实现strStr(char* s, char* t)函数,该函数的作用是返回字符串t第一次出现在字符串s中的下标。解题思路:懒得写

2017-05-16 19:42:41 1001

原创 LeetCode 19 Remove Nth Node From End of List(二级指针)

Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end, the l

2017-05-15 22:12:20 578

原创 LeetCode 35 Search Insert Position(插入排序)

Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates in the array.

2017-05-14 22:52:46 613

原创 LeetCode 64 Minimum Path Sum(动态规划)

Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.Note: You can only move either down or right at

2017-05-13 22:16:29 827

原创 LeetCode 70 Climbing Stairs(记忆化搜索)

You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?Note: Given n will be a positive

2017-05-13 13:09:34 1136

原创 LeetCode 72 Edit Distance(动态规划)

Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)You have the following 3 operations permitted on a word:

2017-05-13 09:36:25 646

原创 LeetCode 83 Remove Duplicates from Sorted List(链表操作)

Given a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, return 1->2->3.题目大意:给出一个排好序的链表,去掉里面的重复元素。

2017-05-12 19:51:18 891

原创 LeetCode 62 Unique Paths(记忆化搜索)

The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked 'Finish' in the diagram below).How many possible unique pa

2017-05-12 08:30:23 518

原创 LeetCode 445 Add Two Numbers II(栈+链表)

You are given two non-empty linked lists representing two non-negative integers. The most significant digit comes first and each of their nodes contain a single digit. Add the two numbers and return

2017-05-09 10:55:47 415

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除