![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LeetCode
进阶的工程师
菜鸡程序员
展开
-
Same Tree
题目: 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 and the nodes have the same value. 比较两原创 2016-03-01 22:11:43 · 210 阅读 · 0 评论 -
Surrounded Regions
Given a 2D board containing 'X' and 'O', capture all regions surrounded by 'X'. A region is captured by flipping all 'O's into 'X's in that surrounded region. For example, X X X X X O O X原创 2016-05-10 21:05:06 · 228 阅读 · 0 评论 -
Count of Smaller Numbers After Self
You are given an integer array nums and you have to return a new counts array. The counts array has the property where counts[i] is the number of smaller elements to the right of nums[i]. Exa原创 2016-05-03 20:02:47 · 223 阅读 · 0 评论 -
Count of Smaller Numbers After Self
首先吐槽下CSDN,写完,发表,直接没了,辛苦写的东西就这么不见了…… You are given an integer array nums and you have to return a new counts array. Thecounts array has the property where counts[i] is the number of smaller elem原创 2016-05-03 20:34:12 · 211 阅读 · 0 评论 -
LeetCode-Roman to Integer-scala
刚刚接触scala语言,所以写的不符合函数式编程风格,拿简单的题目来熟悉下语言。这道题目很简单,只要知道罗马数字是怎么计数的就好。 def romanToInt(s: String): Int = { val numList = new Array[Int](s.length); var i = 0 while(i < s.length){ numList(i原创 2017-12-18 00:41:33 · 200 阅读 · 0 评论 -
Leetcode-Rank Scores
LeeCode上的database题目,Rank Scores。 # Write your MySQL query statement below set @rankNum=0; select Scores.Score, rank_t.Rank from Scores left join ( select score_t.Score, (@rankNum:=@rankNum+1) A原创 2018-01-08 20:43:36 · 210 阅读 · 0 评论 -
LeetCode-Add Two Numbers-Java
LeetCode题目: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 d原创 2018-01-08 23:03:43 · 160 阅读 · 0 评论 -
LeetCode-Power of Two-Java
题目: Given an integer, write a function to determine if it is a power of two. 判断整数n是否是2的次幂,比较简洁的解法就是,利用位运算,如果是2的次幂,那么转为2进制后,只会有一个1, 代码: public boolean isPowerOfTwo(int n) { if(n <= 0)原创 2018-01-09 00:57:59 · 162 阅读 · 0 评论