LeetCode题解(七)0600-0699,大厂经典高频面试题体系化集合

| 1 | A | m | 2500 |

| 2 | B | f | 1500 |

| 3 | C | m | 5500 |

| 4 | D | f | 500 |

After running your update statement, the above salary table should have the following rows:

| id | name | sex | salary |

| — | — | — | — |

| 1 | A | f | 2500 |

| 2 | B | m | 1500 |

| 3 | C | f | 5500 |

| 4 | D | m | 500 |

[Answer]

Runtime: 151 ms, faster than 61.29% of MySQL online submissions for Swap Salary.

Memory Usage: N/A

Write your MySQL query statement below

UPDATE salary SET sex = IF(sex = ‘f’, ‘m’, ‘f’)

657. Robot Return to Origin

[Description]

There is a robot starting at position (0, 0), the origin, on a 2D plane. Given a sequence of its moves, judge if this robot ends up at (0, 0) after it completes its moves.

The move sequence is represented by a string, and the character moves[i] represents its ith move. Valid moves are R (right), L (left), U (up), and D (down). If the robot returns to the origin after it finishes all of its moves, return true. Otherwise, return false.

Note: The way that the robot is “facing” is irrelevant. “R” will always make the robot move to the right once, “L” will always make it move left, etc. Also, assume that the magnitude of the robot’s movement is the same for each move.

Example 1:

Input: “UD”

Output: true

Explanation: The robot moves up once, and then down once. All moves have the same magnitude, so it ended up at the origin where it started. Therefore, we return true.

Example 2:

Input: “LL”

Output: false

Explanation: The robot moves left twice. It ends up two “moves” to the left of the origin. We return false because it is not at the origin at the end of its moves.

[Answer]

Runtime: 5 ms, faster than 94.72% of Java online submissions for Robot Return to Origin.

Memory Usage: 36.8 MB, less than 99.80% of Java online submissions for Robot Return to Origin.

class Solution {

public boolean judgeCircle(String moves) {

if (moves == null || moves.trim().length() == 0)

return true;

int x = 0, y = 0;

for (char c : moves.toCharArray()) {

switch © {

case ‘L’:

x–;

break;

case ‘R’:

x++;

break;

case ‘U’:

y++;

break;

case ‘D’:

y–;

break;

}

}

return x == 0 && y == 0;

}

}

665. Non-decreasing Array

Runtime: 1 ms, faster than 99.42% of Java online submissions for Non-decreasing Array.

Memory Usage: 46.6 MB, less than 9.52% of Java online submissions for Non-decreasing Array.

class Solution {

public static boolean checkPossibility(int[] nums) {

for(int i = 0; i < nums.length - 1; i++){

//first occurance

if(nums[i] > nums[i+1]){

for(int j = i + 1; j < nums.length - 1; j++){

//second occurance

if (nums[j] > nums[j+1])

return false;

}

if(i == 0 || i + 2 > nums.length - 1){

return true;

}

if(nums[i] > nums[i + 2]){

自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。

深知大多数初中级安卓工程师,想要提升技能,往往是自己摸索成长,但自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!

因此收集整理了一份《2024年最新Android移动开发全套学习资料》送给大家,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。
img
img
img
img

由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频
如果你觉得这些内容对你有帮助,可以添加下面V无偿领取!(备注Android)
img

新的开始

改变人生,没有什么捷径可言,这条路需要自己亲自去走一走,只有深入思考,不断反思总结,保持学习的热情,一步一步构建自己完整的知识体系,才是最终的制胜之道,也是程序员应该承担的使命。

如果有需要进阶Android高级工程师系统学习资料的,我可以免费分享给大家,需要完整版的朋友,【点这里可以看到全部内容】。

《系列学习视频》

《系列学习文档》

《我的大厂面试之旅》

https://bbs.csdn.net/topics/618156601)】。**

《系列学习视频》
[外链图片转存中…(img-8iuQYeXj-1710668375366)]

《系列学习文档》

[外链图片转存中…(img-OahezSm7-1710668375367)]

《我的大厂面试之旅》

[外链图片转存中…(img-XV3ZWEri-1710668375367)]

  • 18
    点赞
  • 21
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值