First thing first, lets install some tools we need.
To make life easier, I have updated my zshrc file, so i can run wabt commands. Like
As you can see, I have downloaded wabt in Downloads folder and I unzip there.
Now run the command from a different terminal
If that works, you are ready to write your…
Given an integer
n (in base
10) and a base
k, return the sum of the digits of
n after converting
n from base
10 to base
After converting, each digit should be interpreted as a base
10 number, and the sum should be returned in base
Input: n = 34, k = 6
Explanation: 34 (base 10) expressed in base 6 is 54. 5 + 4 = 9.
Input: n = 10, k = 10
Explanation: n is already in base 10. 1 + 0 = 1.
The frequency of an element is the number of times it occurs in an array.
You are given an integer array
nums and an integer
k. In one operation, you can choose an index of
nums and increment the element at that index by
Return the maximum possible frequency of an element after performing at most
Input: nums = [1,2,4], k = 5
Explanation: Increment the first element three times and the second element two times to make nums = [4,4,4].
4 has a frequency of 3.
Input: nums = [1,4,8,13]…
You are given two positive integer arrays
nums2, both of length
The absolute sum difference of arrays
nums2 is defined as the sum of
|nums1[i] - nums2[i]| for each
0 <= i < n (0-indexed).
You can replace at most one element of
nums1 with any other element in
nums1 to minimize the absolute sum difference.
Return the minimum absolute sum difference after replacing at most one element in the array
nums1. Since the answer may be large, return it modulo
109 + 7.
|x| is defined as:
x >= 0, or
You are given the logs for users’ actions on LeetCode, and an integer
k. The logs are represented by a 2D integer array
logs where each
logs[i] = [IDi, timei] indicates that the user with
IDi performed an action at the minute
Multiple users can perform actions simultaneously, and a single user can perform multiple actions in the same minute.
The user active minutes (UAM) for a given user is defined as the number of unique minutes in which the user performed an action on LeetCode. …
A sentence is a list of words that are separated by a single space with no leading or trailing spaces. Each of the words consists of only uppercase and lowercase English letters (no punctuation).
"hello world hello world"are all sentences.
You are given a sentence
s and an integer
k. You want to truncate
s such that it contains only the first
k words. Return
s after truncating it.
Input: s = "Hello how are you Contestant", k = 4
Output: "Hello how are you"
The words in s are ["Hello", "how" "are"…
You are given an even integer
n. You initially have a permutation
perm of size
perm[i] == i (0-indexed).
In one operation, you will create a new array
arr, and for each
i % 2 == 0, then
arr[i] = perm[i / 2].
i % 2 == 1, then
arr[i] = perm[n / 2 + (i - 1) / 2].
You will then assign
Return the minimum non-zero number of operations you need to perform on
perm to return the permutation to its initial value.
Input: n = 2
You are given a string
s that contains some bracket pairs, with each pair containing a non-empty key.
"(name)is(age)yearsold", there are two bracket pairs that contain the keys
You know the values of a wide range of keys. This is represented by a 2D string array
knowledge where each
knowledge[i] = [keyi, valuei] indicates that key
keyi has a value of
You are tasked to evaluate all of the bracket pairs. When you evaluate a bracket pair that contains some key
keyi, you will:
keyiand the bracket pair with…
2. Bresenham’s Circle Drawing Algorithm
3. Aho Corasick for string pattern matching
Note: It will be synced with github…
newJob = getNewJobFromCrontabFile() // blocking call
JobThread newJobThread = new JobThread(newJob);
Thread.sleep(job.getNextExecutionTime() - currentTime());
job.setNextExecutionTime(currentTime() + job.getExecutionInterval());
Enterprise Applications Architectecture | JAVA | Rust |Parallel & Distributed Programing | Node.js | IoT | Golang |Starter|Microservices