This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Build a Rails API that accepts input which is a N x M matrix containing only 1 & 0 as elements, return a sub-matrix of maximum size with all 1s. | |
For example, consider the below matrix. | |
matrix = [ | |
[1, 0, 1, 1], | |
[0, 1, 0, 1], | |
[1, 1, 1, 0], | |
[1, 1, 1, 1] | |
] | |
The submatix with only 1's & maximum size is | |
[ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Amura | |
class SidekiqManager | |
# a datastructure to maintain queue meta data. the structure of which is {host_name: {queue_name:{min:1,max:1,conc:10,latency:1,queue_size:10,kill_idle:-1, tags:['default'], total_checks:1,current_check:0}}} | |
# host_name - name of the machine where its running. useful in a distributed environment where app is running on mulitple instances | |
# queue_name - name of the queue (which you can mention in the sidekiq worker as sidekiq_options :queue => :mailer ) | |
# min: minimum number of processes required to process this queue on this machine. | |
# max: maximum number of processes permitted to process this queue on this machine. a upper limit to avoid memory overflow and unlimited process spawning. | |
# conc: concurreny (number of worker threads) for each of the processes. this is -C option given while booting up sidekiq. | |
# latency: this is the default safe latency which is permissable for this queue. anything beyond this will trigger new p |