摘要:
Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3,Return [1,3,3,1]. 也可以和 Leetcode 118 Pascal's Triangle II 一样构造最 阅读全文
摘要:
Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5,Return 转移方程 p[i][j] = p[i-1][j-1] + p[i-1][j] 或者每次手动构造下 阅读全文
摘要:
Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. For example, given the fo 阅读全文
摘要:
Determine whether an integer is a palindrome. Do this without extra space.利用余数构造倒置数再判断。var isPalindrome = function(x) { var y = 0 var t = x w... 阅读全文
摘要:
Reverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321这里转成字符后倒置后转回数字。var reverse = function(x) { function rev(n){ ... 阅读全文
摘要:
Given an array of integers, every element appearsthreetimes except for one. Find that single one.Note:Your algorithm should have a linear runtime comp... 阅读全文
摘要:
Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Follow up:Can you solve it without using extra space?同Le... 阅读全文
摘要:
Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?LL经典题:一个指针每次前进1node,另一个指针每次前进2node,如果有环则必会... 阅读全文
摘要:
Given an array of integers, every element appearstwiceexcept for one. Find that single one.传统方法:使用Hash,扫描一遍如果Hash中没有这个元素则加入,否则从Hash中删除,最后Hash中留有一个单独的元... 阅读全文
摘要:
Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical an... 阅读全文