- 博客(76)
- 收藏
- 关注
原创 非线性优化
对于一个slam系统,我们可以得到motion function 和 estimation function,如下所示: {xk=f(xk−1,μk)+wkzk,j=h(yj,xk)+vk,j{xk=f(xk−1,μk)+wkzk,j=h(yj,xk)+vk,j\left\{\begin{matrix}x_{k}=f\left ( x_{k-1,\mu _{k}} \right )+w_{k}...
2018-03-19 10:02:05
8656
原创 Bayesian estimation of the mean of a normal distribution
最近在学习lsd slam,在depth estimation中,需要用到bayesian estimation, 假设分布为:yn=N(Θ,σ2)yn=N(Θ,σ2)y_{n}=N\left ( \Theta, \sigma ^{2} \right ). 其中ΘΘ\Theta为待估计待量,σσ\sigma是已知的。在这种情况下,我们假设我们拥有一个conjugate prior p(Θ)∝exp...
2018-03-18 04:27:30
253
原创 71. Simplify Path
Given an absolute path for a file (Unix-style), simplify it.For example,path = "/home/", => "/home"path = "/a/./b/../../c/", => "/c"Corner Cases:Did you consider the case where p
2018-01-14 05:29:06
217
原创 544. Output Contest Matches
During the NBA playoffs, we always arrange the rather strong team to play with the rather weak team, like make the rank 1 team play with the rank nth team, which is a good strategy to make the conte
2018-01-14 03:10:02
224
原创 22. Generate Parentheses
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:[ "((()))", "(()())", "(())()", "()(())
2018-01-14 02:42:31
127
原创 20. Valid Parentheses
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the correct order, "()" and "()[]{}" are all va
2018-01-14 02:34:22
107
原创 50. Pow(x, n)
Implement pow(x, n).Example 1:Input: 2.00000, 10Output: 1024.00000Example 2:Input: 2.10000, 3Output: 9.26100class Solution {public: double myPow(double x, int n) {
2018-01-14 02:13:59
120
原创 479. Largest Palindrome Product
Find the largest palindrome made from the product of two n-digit numbers.Since the result could be very large, you should return the largest palindrome mod 1337.Example:Input: 2Output:
2018-01-13 04:46:20
137
原创 179. Largest Number
Given a list of non negative integers, arrange them such that they form the largest number.For example, given [3, 30, 34, 5, 9], the largest formed number is 9534330.Note: The result may be ve
2018-01-12 23:09:04
573
原创 371. Sum of Two Integers
Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -.Example:Given a = 1 and b = 2, return 3.00 + 00->0000 + 01-> 0101 + 00-> 0101 + 01-> 10cl
2018-01-12 03:38:27
114
原创 724. Find Pivot Index
Given an array of integers nums, write a method that returns the "pivot" index of this array.We define the pivot index as the index where the sum of the numbers to the left of the index is equal t
2018-01-11 10:43:10
142
原创 523. Continuous Subarray Sum
Given a list of non-negative numbers and a target integer k, write a function to check if the array has a continuous subarray of size at least 2 that sums up to the multiple of k, that is, sums up t
2018-01-11 09:40:40
143
原创 560. Subarray Sum Equals K
560. Subarray Sum Equals KGiven an array of integers and an integer k, you need to find the total number of continuous subarrays whose sum equals to k.Example 1:Input:nums = [1,1,1], k
2018-01-11 08:35:09
152
原创 697. Degree of an Array
Given a non-empty array of non-negative integers nums, the degree of this array is defined as the maximum frequency of any one of its elements.Your task is to find the smallest possible length o
2018-01-11 08:11:49
192
原创 53. Maximum Subarray
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [-2,1,-3,4,-1,2,1,-5,4],the contiguous subarray [4,-1,2,1]
2018-01-11 06:48:23
113
原创 681. Next Closest Time
Given a time represented in the format "HH:MM", form the next closest time by reusing the current digits. There is no limit on how many times a digit can be reused.You may assume the given input str
2018-01-10 14:56:12
297
原创 746. Min Cost Climbing Stairs
On a staircase, the i-th step has some non-negative cost cost[i] assigned (0 indexed).Once you pay the cost, you can either climb one or two steps. You need to find minimum cost to reach the top
2018-01-10 12:55:57
147
原创 739. Daily Temperatures
Given a list of daily temperatures, produce a list that, for each day in the input, tells you how many days you would have to wait until a warmer temperature. If there is no future day for which thi
2018-01-10 12:31:27
142
原创 314. Binary Tree Vertical Order Traversal
Given a binary tree, return the vertical order traversal of its nodes' values. (ie, from top to bottom, column by column).If two nodes are in the same row and column, the order should be from left
2018-01-10 11:48:42
142
原创 25. Reverse Nodes in k-Group
Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.k is a positive integer and is less than or equal to the length of the linked list. If the number o
2018-01-10 01:08:20
125
原创 109. Convert Sorted List to Binary Search Tree
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.For this problem, a height-balanced binary tree is defined as a binary tree in which th
2018-01-09 22:33:58
107
原创 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.需要注意只存在一个节点的情况,/**
2018-01-09 21:50:24
106
原创 203. Remove Linked List Elements
Remove all elements from a linked list of integers that have value val.ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6Return: 1 --> 2 --> 3 --> 4 --> 5Credits:Special than
2018-01-09 21:21:32
109
原创 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-01-09 21:20:47
103
原创 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
2018-01-09 11:03:02
108
原创 24. Swap Nodes in Pairs
Given a linked list, swap every two adjacent nodes and return its head.For example,Given 1->2->3->4, you should return the list as 2->1->4->3.Your algorithm should use only constant space. Y
2018-01-09 09:18:12
118
原创 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 ↘
2018-01-09 08:53:33
120
原创 92. Reverse Linked List II
Reverse a linked list from position m to n. Do it in-place and in one-pass.For example:Given 1->2->3->4->5->NULL, m = 2 and n = 4,return 1->4->3->2->5->NULL.Note:Given m, n satisfy the
2018-01-09 08:32:19
109
原创 725. Split Linked List in Parts
Given a (singly) linked list with head node root, write a function to split the linked list into k consecutive linked list "parts".The length of each part should be as equal as possible: no two
2018-01-09 02:43:57
138
原创 328. Odd Even Linked List
这个题是把链表进行重新排序,先把奇数节点放在一起,再把偶数节点放在一起。需要注意: odd_node->next = NULL 要写上,否则会出现错误** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode
2018-01-09 01:30:39
114
原创 234. Palindrome Linked List
Given a singly linked list, determine if it is a palindrome.Follow up:Could you do it in O(n) time and O(1) space?这个题目在discussion里有人证明了空间复杂度不可能为O(1)。/** * Definition for singly-linked list.
2018-01-08 21:16:16
111
原创 138. Copy List with Random Pointer 133. Clone Graph
133:/** * Definition for undirected graph. * struct UndirectedGraphNode { * int label; * vector neighbors; * UndirectedGraphNode(int x) : label(x) {}; * }; */class Soluti
2018-01-08 20:43:45
111
原创 206. Reverse Linked List
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: Li
2018-01-08 18:39:23
109
原创 148. Sort List 21. Merge Two Sorted Lists
很好的一个模板题,链表找中点(快慢指针)和merge。/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */clas
2018-01-08 14:00:26
121
原创 415. Add Strings
这个题很简单,仅此记录一下;class Solution {public: string addStrings(string num1, string num2) { int size1 = num1.size(); int size2 = num2.size(); string res = ""; int
2018-01-08 13:02:45
104
原创 43. Multiply Strings
Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2.Note:The length of both num1 and num2 is Both num1 and num2 contains only digits
2018-01-08 13:01:47
106
原创 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 i
2018-01-08 11:45:15
115
原创 2. 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 contain a single digit. Add the two numbers and return
2018-01-08 11:05:36
138
原创 369. Plus One Linked List
time:2018.01.07Given a non-negative integer represented as non-empty a singly linked list of digits, plus one to the integer.You may assume the integer do not contain any leading zero, except
2018-01-08 09:45:37
205
原创 337. House Robber III
The thief has found himself a new place for his thievery again. There is only one entrance to this area, called the "root." Besides the root, each house has one and only one parent house. After a tour
2017-10-02 12:04:27
156
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人