ARTS Week 18
--
Algorithm
This week’s LeetCode problem is 55. Jump Game
You are given an integer array nums
. You are initially positioned at the array's first index, and each element in the array represents your maximum jump length at that position. Return true
if you can reach the last index, or false
otherwise.
Example 1:
Input: nums = [2,3,1,1,4]
Output: true
Explanation: Jump 1 step from index 0 to 1, then 3 steps to the last index.Example 2:
Input: nums = [3,2,1,0,4]
Output: false
Explanation: You will always arrive at index 3 no matter what. Its maximum jump length is 0, which makes it impossible to reach the last index.class Solution {
public boolean canJump(int[] nums) {
boolean ans = false;
int maxIndex = 0;
for (int i = 0; i < nums.length; i++) {
if (i <= maxIndex) {
maxIndex = Math.max(maxIndex, i + nums[i]);
if (maxIndex >= nums.length - 1) {
ans = true;
break;
}
}
}
return ans;
}
}
Review
This week’s Review is for the following article: We Need Your Beginner’s Mind
The author starts with the example of repairing a bicycle and shares how he went from a beginner to a seasoned veteran step by step. The author shares that when he was a beginner, he felt that his progress was slow, he would mess things up, and he would feel frustrated and even doubt himself. But as a beginner, you have a valuable and fleeting perspective on the machine, the “beginner’s mind, which includes your view of the future, the world around you, and how to start taking your first steps, and will eventually disappear forever as you learn more. These are indeed superpowers that we tend to overlook because we are stuck in a rut as beginners, and in this state.
- You are naturally free from views and opinions that make it hard to learn more.
- Your stumbling and experiments makes it easier for others to stumble and experiment.
- Your role as the student means someone else gets to play the teacher.
- The answer to the question you’re scared to ask will help others.
The authors also give out ways to help beginners embrace beginner’s thinking by
- Recognizing its value and acknowledging its transiency.
- Asking all of your good questions to your company, your team, or even just one person that you trust.
- Recognizing that asking someone to teach you is a gift to them.
- Remembering that we were all there at some point, even that one intimidating person.
At the same time, the author gives tips on how an experienced person can better help beginners.
- Encouraging questions and asking your own “dumb” questions.
- Embracing the teacher role by taking your time to educate others.
- If you don’t have the time to give a great answer, saying so and coming back when you can.
- Telling the stories about your mistakes, disasters, and missteps.
Tip
How Markdown implements superscript and subscript. Markdown can use the <sup></sup>
tag to achieve the superscript effect, and the <sub></sub>
tag to achieve the subscript effect. For example, A<sup>1</sup>
will be displayed as A1, and B<sub>2</sub>
will be displayed as B2.
It is worth noting that this syntax is not the basic syntax of Markdown, so not all editors and online platforms will support it. At least Github is currently supported :).
Share
Unknowingly, December is about to end again, but at present, I can only guarantee ARTS updates every week, and I am ashamed that I cannot update blog posts with other content :( :( :(.