All Questions
6 questions
3
votes
1
answer
853
views
Divide array into three disjoint sets with equal sum
Problem definition : Array partition problem
Given an array of positive integers, divide it into three disjoint subsets having equal sum. These disjoint sets cover the complete array.
Example
Input: [...
8
votes
2
answers
784
views
Optimize function that returns length of a subarray
I did an exercise today on where the task is to write a function that returns the length of the longest subarray where the difference between the smallest and biggest value in the subarray is no more ...
3
votes
3
answers
659
views
Given an array, find all its elements that can become a leader
I was successful in solving a challenge in codility, but my solution failed performance tests. How can I improve my solution?
Challenge:
Integers K, M and a non-empty array A consisting of N ...
1
vote
2
answers
507
views
Maximum contiguous sum in an array
The following code is my solution for the following Daily Coding Challenge
Given an array of numbers, find the maximum sum of any contiguous
subarray of the array.
For example, given the ...
4
votes
0
answers
223
views
Finding where column slices of elements in multi-dimensional array are equal
Skippable Intro:
I have a dataset that corresponds to an observed time-series. The dataset is organized into a dictionary - which contains an array of years, an array of months, an array of days, an ...
8
votes
2
answers
3k
views
To the right, to the left, now rotate
I was working on HackerRank: Circular Array Rotation which is about coming up with an efficient algorithm for array rotations in right-ward manner.
John Watson performs an operation called a right ...