1. Add Dependency in pom.xml <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <scope>runtime</scope> </dependency> 2. In your intellij IDEA go to: file->settings->build,execution,deployment. Go to ->compiler->build project automatically. 3. Advanced Setting -> Enable auto-make
Algorithm Pattern – Island Programs LC 200 1254 1020 695 1905 694
Algorithm Pattern In a traditional way, we can use a visited array to mark if a cell has been visited. However, if it is allowed, we can also set the visited cell as 0 (ocean indicator) as well. And in some special cases, like if you need to know if a visited cell is valid …
Continue reading “Algorithm Pattern – Island Programs LC 200 1254 1020 695 1905 694”
Algorithm Pattern – Binary Search
Algorithm Pattern 1 – Find the target element class Solution { public int search(int[] nums, int target) { int left = 0, right = nums.length – 1; while(left <= right){ int mid = left + (right – left) / 2; if(nums[mid] == target){ return mid; } else if(nums[mid] < target){ left = mid + 1; …
Algorithm Pattern – Sliding Window
Problem Usually if you are asked to find out substring based on one string pattern in another string, it means you have to check all possible substring in one string, so you should maintain a sliding window to check each substring candidate. Thought For convenience, I call two strings as pattern string and explore string. …
Algorithm Pattern – Rotate & Spiral Array (LC 48 54 59)
Thought For the rotation question, we could get an easy approach by observing the rotation result. For the Spiral question, we should set the four dimension ranges and keep updating them. Example 48. Rotate Image (https://leetcode.com/problems/rotate-image/) You are given an n x n 2D matrix representing an image, rotate the image by 90 degrees (clockwise). …
Continue reading “Algorithm Pattern – Rotate & Spiral Array (LC 48 54 59)”
Algorithm Pattern – Monotone Stack (LC 496 739 503)
Question Monotone Stack question usually ask you to find the next greater integer in an array. Approach Maintain a monotone stack, which stores index of descending integers, and while you face an element greater than the top of stack, we could assign this element as the next greater integer. Algorithm Pattern Deque<Integer> stack = new …
Continue reading “Algorithm Pattern – Monotone Stack (LC 496 739 503)”
Properties and advantages of REST APIs
Client-server architecture The API defines all communication between the client and the server, which are separate components and free to be developed independently. Layered system The client is indifferent to whether it is communicating directly or indirectly with the server. Cacheability A response can be cached if the same request will return the same result …