Home
Deercode
Cancel

[LeetCode Solution] 189. Rotate Array

Problem Description Rotate Array Rotate the elements of a list by k. Solution Approach For the input list [1,2,3,4,5,6,7] and k=3, a simple approach is to iterate through the list and shift each ...

[LeetCode Solution] 122. Best Time to Buy and Sell Stock II

Problem Description Best Time to Buy and Sell Stock II Calculate the maximum profit that can be obtained by buying and selling stocks multiple times. Unlike Best Time to Buy and Sell Stock, this p...

[LeetCode Solution] 121. Best Time to Buy and Sell Stock

Problem Description Best Time to Buy and Sell Stock Calculate the maximum profit that can be obtained by buying and selling stocks once. Solution Approach To find the maximum profit when buying a...

[LeetCode Solution] 88. Merge Sorted Array

Problem Description LeetCode 88. Merge Sorted Array Given two ascending order lists, merge them into a single sorted list. However, there is a condition: the sorting must be done in-place on the n...

[LeetCode Solution] 80. Remove Duplicates from Sorted Array II

Problem Description LeetCode 80. Remove Duplicates from Sorted Array II Remove duplicates from the array, keeping at most two occurrences of each element. Solution Approach: Two Pointer I used tw...

[LeetCode Solution] 27. Remove Element

Problem Description LeetCode 27. Remove Element Algorithm to remove the specified value (val) from the list and determine the remaining number of elements. Solution Approach 1. 1) Traverse nums a...

[LeetCode Solution] 26. Remove Duplicates from Sorted Array

Problem Description LeetCode 26. Remove Duplicates from Sorted Array Algorithm to remove duplicates from a sorted array and return the value of the remaining elements. Solution Approach: Two Poin...

[LeetCode Solution] 169. Majority Element

Problem Description LeetCode 169. Majority Element Find the element that appears more than n/2 times in a list. Solution Approach: Two Pointer 1) Traverse the entire list and create a dictionary....

[kubernetes] How to Check Expiry Date of k8s Client Config Certificates

Kubernetes Certificate Expiry Alert A client certificate used to authenticate to the Kubernetes API server is expiring in less than 7.0 days. If you see a message like the one above on your k8s cl...

[Linux] Managing Program Versions with update-alternatives

update-alternatives Command I first came across this command when I was looking for an easy way to switch between multiple versions of PHP installed locally. The update-alternatives command is a Li...