![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LeetCode
文章平均质量分 67
江湖小虾米东方未明
谁会不厌其烦的安慰那无知的少年
展开
-
Pascal's Triangle
发现很多网上没有java版本的代码,故特此奉上。 public ArrayList> generate(int numRows) { // IMPORTANT: Please reset any member data you declared, as // the same Solution instance will be reused for原创 2013-11-04 00:48:07 · 591 阅读 · 0 评论 -
Leetcode Permutations
在结果数组定义为类公有变量结果就超时了。 public class Solution { static ArrayList> a = new ArrayList>(); public ArrayList> permute(int[] num) { // IMPORTANT: Please reset any member data you declared, as原创 2013-11-19 11:53:29 · 792 阅读 · 0 评论 -
Balanced Binary Tree
Given a binary tree, determine if it is public class Solution { public boolean NotBalancedflag; public boolean isBalanced(TreeNode root) { // IMPORTANT: Please reset any member data you declared原创 2013-11-05 22:18:58 · 573 阅读 · 0 评论 -
Valid Sudoku
/** * Created by jason on 13-12-16. */ public class ValidSudoku { public boolean isValidSudoku(char[][] board) { return isvalidRow(board) && isvalidColumn(board) && isvalidRegieon(board原创 2013-12-16 14:40:53 · 632 阅读 · 0 评论 -
Length of Last Word
求最后一个字符的长度。一个比较好的想法就是找到最后一个单词前面的空格的index,然后通过字符串长度减去index得到最后一个word的长度。 当然这种想法的前提条件是改字符串不以空格结束,所以要先对字符串进行处理,尾部空格去掉。 代码如下: /** * Created by jason on 13-12-17. */ public class lengthOfLastWord {原创 2013-12-18 01:11:15 · 675 阅读 · 0 评论 -
leetcode数据库题集持续更新中
Combine Two Tables +-------------+---------+ | Column Name | Type | +-------------+---------+ | PersonId | int | | FirstName | varchar | | LastName | varchar | +-------------+-----原创 2015-04-14 10:29:43 · 1704 阅读 · 0 评论 -
LeetCode上二叉树的线性化与解线性化
前次写的后来一想发现完全是错的,这次重写写了一遍,应该没错了。 LeetCode上二叉树构造如下: For example: Given binary tree {3,9,20,#,#,15,7}, 3 / \ 9 20 / \ 15 7 我的想法构造两个队列A,B与之相对应,如上就是初始化A队列就是{3,9,20,null,null,15,原创 2013-11-08 12:03:56 · 875 阅读 · 0 评论