# LeetCode — Jump Game (Blind Curated 26)

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.

Constraints:

• 1 <= nums.length <= 104
• 0 <= nums[i] <= 105

Solution:

Time complexity: O(N)

Space complexity: O(1)

--

--

# 後端軟工常見面試問題 — (一)

Q1. What is abstraction?

Abstraction可以理解為抽象，也屬於OOP (Object-oriented programming)語言裡四大重要特性之一。

• 抽象類別無法建立物件 (Abstract class cannot build an object.)
• 抽象函數不用來處理方式 (Abstract class does not implement methods.)

--

--

# LeetCode — Longest Increasing Subsequence (Blind Curated 18)

Given an integer array nums, return the length of the longest strictly increasing

subsequence

.

Example 1:

Input: nums = [10,9,2,5,3,7,101,18]
Output: 4
Explanation: The longest increasing subsequence is [2,3,7,101], therefore the length is 4.

Example 2:

Input: nums = [0,1,0,3,2,3]
Output: 4

Example 3:

Input: nums = [7,7,7,7,7,7,7]
Output: 1

Constraints:

• 1 <= nums.length <= 2500
• -104 <= nums[i] <= 104

Follow up: Can you come up with an algorithm that runs in O(n log(n)) time complexity?

Solution:

Time complexity: O(Nlog^N)

Space complexity: O(N)

--

--