Sort by absolute value
Given a list of numbers, arrange them in ascending order based on their absolute values.
For example, for the list [-30, -5, 1...
2 years ago
Solved
Reverse Integer
You are given an integer, reverse its digits. For negative integers, the sign should remain in the front.
For instance, 12340 s...
2 years ago
Solved
Remove Unique Elements
Given a list of integers, we want to keep only the non-unique elements in this list. To do this, we need to remove all the uniqu...
Draw 'W'
For any given n, return a matrix of height n and width 4n-3 containing a W of ones.
Example:
n=2
ans=
[1 0 1 0 1
0 1 0 1 0...
2 years ago
Solved
Sum of 2 numbers in array
Given an array and a target sum, return true if any 2 numbers in the array sum up to the given target sum. Both numbers cannot h...
Ridge regularized linear regression
Given a predictor data matrix of size , target variable vector of size and a shrinkage factor (scalar) (ridge regularization...
2 years ago
Solved
Sequence
Let S be a sequence of numbers
Let
Find for some , where and .
Update - test suite cleaned up on 2-9-22
2 years ago
Solved
Number of leaps in binary search
Binary search is one of the most popular searching algorithms (Binary Search Algorithm). It works only in a sorted array. It uti...
2 years ago
Solved
Cut the rod
A rod of length n can be cut in different sizes. Different price is associated with different length of cuts.
length, len= [1,...
2 years ago
Solved
Chain multiplication - 01
Say, you are given two matrices - A (shape= 3*4) and B(shape = 4*5).
If you multiply these two matrices, the resultant matrix w...