摘要: select d.Name Department, e1.Name Employee, e1.Salary from Employee e1 join Department d on e1.DepartmentId = d.Id where 3 > (select count(distinct(e2.Salary)) from Employee e2 ... 阅读全文
posted @ 2017-10-25 04:41 Weiyu Wang 阅读(103) 评论(0) 推荐(0) 编辑
摘要: SELECT dep.Name as Department, emp.Name as Employee, emp.Salary from Department dep, Employee emp where emp.DepartmentId=dep.Id and emp.Salary=(Select max(Salary) from Employee e2 where e2.Departm... 阅读全文
posted @ 2017-10-25 04:40 Weiyu Wang 阅读(69) 评论(0) 推荐(0) 编辑
摘要: Select DISTINCT l1.Num from Logs l1, Logs l2, Logs l3 where l1.Id=l2.Id-1 and l2.Id=l3.Id-1 and l1.Num=l2.Num and l2.Num=l3.Num 阅读全文
posted @ 2017-10-25 04:39 Weiyu Wang 阅读(107) 评论(0) 推荐(0) 编辑
摘要: class Solution { public String largestNumber(int[] nums) { String[] arr=new String[nums.length]; for(int i=0;i{return new String(b+a).compareTo(a+b);}); if(arr[0].charAt(0... 阅读全文
posted @ 2017-10-25 04:35 Weiyu Wang 阅读(92) 评论(0) 推荐(0) 编辑
摘要: SELECT Score, (SELECT count(distinct Score) FROM Scores WHERE Score >= s.Score) Rank FROM Scores s ORDER BY Score desc 阅读全文
posted @ 2017-10-25 03:13 Weiyu Wang 阅读(95) 评论(0) 推荐(0) 编辑
摘要: CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT BEGIN DECLARE M INT; SET M=N-1; RETURN ( # Write your MySQL query statement below. SELECT DISTINCT Salary FROM Employee ORDER BY S... 阅读全文
posted @ 2017-10-25 03:10 Weiyu Wang 阅读(236) 评论(0) 推荐(0) 编辑
摘要: class Solution { public int calculateMinimumHP(int[][] dungeon) { if(dungeon.length==0||dungeon[0].length==0) return 0; int M=dungeon.length; int N=dungeon[0].... 阅读全文
posted @ 2017-10-25 02:55 Weiyu Wang 阅读(86) 评论(0) 推荐(0) 编辑
摘要: /** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ public class BSTIterator { ... 阅读全文
posted @ 2017-10-25 01:00 Weiyu Wang 阅读(95) 评论(0) 推荐(0) 编辑