This file contains 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
MAX_ROW=500 | |
MAX_COL=500 | |
def assign_walls(row,col): | |
w = raw_input() | |
inp = w.split(" ") | |
if inp[0] is 'C': | |
col.append(int(inp[1])) | |
else: |
This file contains 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
The current approach will have complexity of KO(logN) where K is the number of lines in the file supplied. This complexity can be further improved if i know the range of the numbers which can be supplied. If the range is much less then K, then a different algorithm can be applied which should possibly reduce the complexity to K. |
This file contains 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
package com.intercom.biplav.flatten; | |
import java.util.LinkedList; | |
import java.util.List; | |
public class ArrayUtils { | |
private void flatten(Object[] toflatten, List<Object> flat) throws Exception { | |
for(Object each: toflatten) { | |
if(each instanceof Object[]) { |