- 博客(10)
- 收藏
- 关注
翻译 leetcode:有趣电影
select *from cinema where mod(id, 2) = 1 and description != 'boring'order by rating DESC;
2019-04-01 14:12:45 155
翻译 leetcode:宝石与石头
class Solution {public int numJewelsInStones(String J, String S) {char[] j=J.toCharArray();char[] s=S.toCharArray();int count[]=new int [‘z’-‘A’+1];//创建一个数组记录每个字符出现的次数for(char ch:s){count[ch-‘A...
2019-04-01 13:58:48 114
翻译 leetcode:重复邮箱
select distinct a.Email from Person a,Person b where a.Email=b.Email and a.Id!=b.Id;
2019-04-01 13:45:36 96
翻译 leetcode:大的国家
select name,population,area from World where area>3000000 or population>25000000;
2019-04-01 13:44:08 157
翻译 leetcode:有序数组的平方
class Solution { public int[] sortedSquares(int[] A) { for(int i=0;i<A.length;i++){ A[i]=A[i]*A[i]; } Arrays.sort(A); return A; }}
2019-04-01 13:42:58 163
翻译 leetcode:删除链表中的节点
class Solution { public void deleteNode(ListNode node) { node.val=node.next.val; node.next=node.next.next; }}
2019-04-01 13:41:38 72
翻译 leetcode:翻转图像
class Solution { public int[][] flipAndInvertImage(int[][] A) { for (int i = 0; i < A.length; i++) { for (int j = 0; j < A[i].length/2;j++){ int temp...
2019-04-01 13:37:41 142
翻译 leetcode:唯一摩尔斯密码词
class Solution { private static String[] map = { ".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..", "....
2019-04-01 13:35:32 154
翻译 leetcode:增减字符串匹配
给定只含 “I”(增大)或 “D”(减小)的字符串 S ,令 N = S.length。返回 [0, 1, …, N] 的任意排列 A 使得对于所有 i = 0, …, N-1,都有:如果 S[i] == “I”,那么 A[i] < A[i+1]如果 S[i] == “D”,那么 A[i] > A[i+1]class Solution { public int[] d...
2019-04-01 13:32:35 117
翻译 leetcode:下一个排列
下一个排列(难度中等)实现获取下一个排列的函数,算法需要将给定数字序列重新排列成字典序中下一个更大的排列。如果不存在下一个更大的排列,则将数字重新排列成最小的排列(即升序排列)。必须原地修改,只允许使用额外常数空间。class Solution {public void nextPermutation(int[] nums) {int i = nums.length - 2;wh...
2019-04-01 13:26:29 82
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人