Problem Statement
A river can flow either downhill, or at a level elevation for a certain distance. Given a topographical map (a map representing elevations) and a maximum level flow distance, write a method to determine the largest area that a river can cover, if it starts at any location on the map.
The map will be a
The maximum level flow distance, maxDist, will be the longest a river can travel on level ground. So if the distance is 0, a river must flow downhill. If the distance is 1, it can flow to 1 adjacent coordinate of the same altitude, in each direction, before it must flow downhill. If the distance is 2, immediately after flowing downhill (or from the starting point), the river can flow to any adjacent coordinate of the same altitude, and then once again to any coordinate adjacent to the new one and of the same altitude, before it must go down hill. For this calculation, the river flows in the 4 primary directions (north, south, east, and west). Notice that since a river will go in any direction it can, it's more of a "flood" than a "river". Thus when determining the area covered by a river starting at a certain point, you must find the area of all the points that can be reached following the above constraints.
For example: 0000000000 0111111110 0122222210 0123333210 0123443210 0123443210 0123333210 0122222210 0111111110 0000000000
Represents a peak with an elevation of 4.
If maxDist = 2 and the river starts flowing at the '*' then the river can cover an area of 16, shown by '~'.
~~~~~~~000 ~~*~~11110 ~~22222210 ~123333210 ~123443210 0123443210 0123333210 0122222210 0111111110 0000000000However this isn't the largest area. If the river starts flowing at the peak, then the river can cover the entire area of 100.
Definition
- Class:
- RiverHill
- Method:
- largest
- Parameters:
- String[], int
- Returns:
- int
- Method signature:
- int largest(String[] map, int maxDist)
- (be sure your method is public)
Notes
- The river can only flow north, south, east, and west in determining the maximum level flow distance.
- Each coordinate has an area of 1.
Constraints
- map will contain between 2 and 40 elements, inclusive.
- each element of map will contain between 2 and 40 characters, inclusive.
- each element of map will contain the same number of characters as every other element of map.
- each element of map will contain only the characters '0'-'9' inclusive. There will be no spaces.
- maxDist will be an integer between 0 and 10, inclusive.
Examples
{"0000000000" ,"0111111110" ,"0122222210" ,"0123333210" ,"0123443210" ,"0123443210" ,"0123333210" ,"0122222210" ,"0111111110" ,"0000000000"}
2
Returns: 100
By starting the river at the peak (in either position), the river will be able to flow over the whole mountain.
{"0000000000" ,"0111111110" ,"0122222210" ,"0123333210" ,"0123443210" ,"0123443210" ,"0123333210" ,"0122222210" ,"0111111110" ,"0000000000"}
1
Returns: 95
If you started at the northwest corner of the peak, the only spaces not reachable would be the 5 spaces diagonally southeast from the start.
{"0000000000" ,"0111111110" ,"0122222210" ,"0123333210" ,"0123443210" ,"0123443210" ,"0123333210" ,"0122222210" ,"0111111110" ,"0000000000"}
0
Returns: 9
By starting the river at the peak (at any of the four elevation 4 positions), the river will only be able to flow downward in the 4 main directions, thus it will be two straight streams, with an area of 9.
{"555505555" ,"555515555" ,"555525555" ,"555535555" ,"555545555" ,"555545555" ,"555555555"}
1
Returns: 11
5555~5555 5555~5555 5555~5555 5555~5555 55~5~5555 5~*~~5555 55~555555 One of the best rivers starts at the asterix (*).
{"5565236785012472" ,"3469912625904101" ,"5943545942017700" ,"9109166568720711" ,"6136079994373860" ,"4129136148916755" ,"2975832922074121" ,"4674050103662805" ,"2494729679116165" ,"1611964958059846" ,"2384128690120444" ,"1010697089697114" ,"0089682613597732" ,"4971774663111966" ,"8543141293776080" ,"4298494798935152" ,"5202757354375791" ,"5376161470010537" ,"5696381123743171" ,"1446566116127226"}
2
Returns: 32
One of the best rivers (possibly uniquely the best) starts at the space on the 4th row, 6th column (both 0-indexed). The method returns 32.
{"6492436495","5146701139","3987670052","0373767411","2978259597"}
9
Returns: 14
{"15916464575423","36552359615804","78610873636845","15866713697599","43748836426666","09742368710812","90983474256106","15329927435018","30233396938865","12051508132523","61271170397015","06632099864935","08811320057061","88679745596206","76241568758239","02910888240621","78000133277262","37480202784268","00761967128543","88785488415840","01068634625921","21788257637272","52453835454211","88245115930286","03911885268177","36168026040825","72073783448225","51418584280456","16289454184710"}
4
Returns: 30
{"162602232898602470871684","334881480519615422084623","663785771585311163639032","182480548659922735441979","126635442959177323776863","023234328654183683215773","305329907583555718525279","093979485261763011056802","011404607235922476686098","555201336694144923971137","657878632830657854207743"}
2
Returns: 24
{"6006772026124","2794757486581","4397027275778","2444964438114","0299290750945","8561913158485","3786660781860","7179447881395","6287125572719","7672976625358","3751424093517","0183018869984","5454233274897","6900277131387","0708897399548","4743723610962","3660755447873","1824450596179","0591112007029","5505770962731","0863580178384","8655827669652","0080528318582","9278410329905","3798316078432","8877745649181","5270673907131","2017641704561","6302042595941","1309797549605","2818938342270","2103769305827","3088970381822","4534320035127","3305899501341","0385498617719","1229134932878","6157445128277","8276564419100","7451789608703"}
8
Returns: 38
{"0560458212735059181767049735","7662922803470262812493708017","7418311226700339652813862835","0554458112538348337997892731","9973919558246215691734449124","4895363529300640954630521866","2057475759069672538265689997","4036479399453967893458381201","6302630162199929184231865869","3665414436492784049274131646","7170310335770261143732185746","2315268985058146723475562121","7994684108058552606134539958","5588154553265056745307600146","8764669361601871804514082209","6837064443727221385516955023","1322061279751976634062228264","1677310473767974931510412293","5681960148124647644241760395","1960395510113794090199757916","6460268300445502181892107098","6008852978601421454899885922","3746264123222396438286874817","6573520336090051337935175387","8143838454726309146144172356","9430264779010346621802656116","1957710707488587448065724242","0972079802514810963830137620"}
1
Returns: 37
{"8764124224140901961537962453438697466302","3303015552922947066972183737991150488583","9084538510040471712329037006792290065903","0294864911242069863915885550819059603616","9474128451926772147420699120698426477110","1778879411533995080394766093053310216737","9889727553905415142126645066960886333245","3899640895142523903008339062474823620314","3873394901531800072119183174401954770997"}
8
Returns: 36
{"5677657801586541720","4333268921188615006","6733465857670600209","0324863189636045036","4248543562711126796","5061555952199726061","9701738968418804327","7165119232644075362","1339900258122412247","7911058289712254735","9856207538713865560","9261490229067102439","4382679839623705979","4728940548295756854","0213324614240822832"}
1
Returns: 30
{"7133158404620898660069530040147688904832","3953003849000294024584323598235275768296","5637468385970864702245050245880566771930","2118193887364975148374784764278697517144","6957690065307195354940376604911192905255","2918128452568139598341734226114251334115","5717856510368285012428728067494002995230","9799736933799369175411368013106631654733","7060413685342912279587528552077544176406","1085692976601527347716998365442871549722","8880442006266392538393032049115551813621","5720126197979230829065994636967950987160","9470507369936260980210303616929357311746","2468186699076423222474262229051152405264","4223414448898561253738875258289516615542","1300972564053858600497316774800643693153","9975091181676973777238941643535289854454","5856413839278430621583264253439303275155","4092414813612549328573023682870808295729","1369823234588721144354517934489785716596","3560985258206644510191510306085278675576","5060506565951097263735989911717535192697","1082383223034633230200461644427666532896","4619900136104700491520153176465077553731","5754863695787720806342489567858541117102","0202852497019512860900481851812977424465","9914860879580480501224716537487193745261","4115633885978030037272665029335648217131","5772802488564636953863967565977822977216","1984443139986284045617384809326198370788","4282272040924367132153654439633232054307","3206360358121746521187600987528418581630","8711408845505148161762319308527927490632","6673807748224334980206936994255801126746","4278580444780228343046562565157812517579","8113210987210737894173605851866942062804","7187703064382454263550364051120691340851","6904382114034034336287907688169571833429","7962818074731126711579493996992302882120","4110143362983307678899403763449316972697"}
8
Returns: 45
{"5677657801586541720","4333268921188615006","6733465857670600209","0324863189636045036","4248543562711126796","5061555952199726061","9701738968418804327","7165119232644075362","1339900258122412247","7911058289712254735","9856207538713865560","9261490229067102439","4382679839623705979","4728940548295756854","0213324614240822832"}
2
Returns: 32
{"8968520297569988102143842","8836686411507659580167158","3809058639491730488279304","0979134956866226579078849","9458245508886665248131352","0708108652466168499768428","3772164174047168814498227","5829552898592531292701102","3678749224909874001673270","4003075067880472391680667","4518180484461153203745727","6343681262613231390515083","5033274118915861169394779","1061632812709688312074316","2475294255416040123371005","9261780516794030340875801","1811429222763845276436404","3014893947609729140423720","4474164673398294998635756","8671633341335627593662507","1059260955989294487682006","4181694791944518979806809","9150347118963846057357916","1274049800360927372671116","5110058970052166514739640","0218569599918294016572156","7720676214088035568627165","5460573828846996930019573","1276412429168253192432362","2064843971024572320137356","6395683166271593599680421","7270108376011781585081048","2857182091815535162550701","2025985676781048541207639","4866704398896473591576845","2442059702140793028715060","6035810011787060760141135","5230593067469961226345953"}
10
Returns: 35
{"00016888760114588","56492159900094593","03612793402399276","85200201398866437","64664662972182458"}
3
Returns: 29
{"9790","7226","8307","3093","0807","9963","9814","8933","2777","0566","7853","2937","9674","2450","0691","3279","8448","9109","8567","6064"}
6
Returns: 17
{"54374783929176858747952258055","63523610642615712636750133432","32304775205924714082973563452","88695388181732028257939960355","83128074721023161841904138867","74390036343526984781296138921","22843635569649453960395489976","83641841943172629026961924646","87407848673197625003342975921","15250503998306115271499966436","56996581131222472132077862685","10646942978919326841195658010","84037214325494544633906725632","39065852622029006353977789617","47335073173309932294343848457","19966310912341117303615589352","54827958627436218834709562229","87127480436677489524684809848","21669959311687279571214276557","52119320791303595475421221677","40602944816128645915945569353","18994261210867631900169613575","86329337031125341598727609882"}
3
Returns: 40
{"607250153661875","388534948939471","757639949691957","378799184991397","049917709334994","718798683979298","356656594553165","243020454211604","252374331862942","008604057517579","565971104125474","726205712875547","820701741906853","223574512621656","753340680400263","591337055282942","199706367264472","582194887099878","174077579462762"}
4
Returns: 34
{"67557","28133","27887","64626","13076","77042","37745","34951","79041","98013","73315","21285","65429","65478","42393","41208","21671","21133","49965","49303","49854","74785","76259","88222","64617","29418","91494","65322","53206","38051"}
10
Returns: 32
{"07771908557","42153451497","17507919890","72702977726","42479356388","47932750048","73523567997","83857771062","47681828338","11700277415","25485968352","98028075881","77604428322","59148401751","69804915162","16190222772","17492667286","10486202543","14035278624","33517811007","90914277500","67148654710","39919984252","14482147679","32221277483","76034761216","95190143241","85592740546","50233745043","49359701943"}
7
Returns: 28
{"29842","69330"}
4
Returns: 10
{"7718025295","5611973966","8207937661","1016080205","6909421279","4926090191","9437787327","8240201555","2662599872","5728072472","9214291498","9555262688","5109761898","1697296170","2945566735","9508060899","0511035510","3055119395","9621915964","8796912426","9476695808","3176282794","9372500680","6662920333","9641726186"}
1
Returns: 29
{"15384625880749168632","95928470307753546433","69178569307026426319"}
8
Returns: 15
{"5760538495436073336676196556185","3067407573106213443013836193887","2794806322735746307015654706924","2063284860060021353174709631782","9694139125666299694636645219211","4658945454206794605367685839095","0288060223911150225892311557490","1033184866553196565392103922197","2013721206755503859076882731282","8596069661071547928243651971860","0979265412705283489786689930578","0356393920784877220513782703235","7533116160360835261242806584595","2281855906213374552048068114910"}
10
Returns: 43
{"322254553112119443","847334771056828558","309896380471029501","003066691843504910"}
5
Returns: 26
{"1100486116196","1922151483623","0003527468634","9175590869992","8104035375656","2175314531371","6879337326762","0490321513062","4374950652112","1267070611665","8175933918543","7675630175666","6434879021946","0001439819748","8943527677002","0250695756631","0799753012399","1691129800862","5579172999657","0314214975983","2839239097182","1991206023787","5280152840490","5338310654241","1712576646250","7564228340695","7186576553980","6239718191208","9575450301823","5903794504300","1958699898649","0247599425647"}
0
Returns: 19
{"7125404514591780870180349836557027995","7181434519896557253657372894459789680","6265115789511728886255943618803332337","0510928293251989618646171238983795901","3312207994474489117374112058996908699","4598332330055658331684431821681777512","0364691077705142169204238720987231397","2897411379265062407403431305140262172","9366895085877543483439400717025813307","7348673369437779770764834924807956796","4439759613751557241438810737638492286","2904217112457901968130893787802767560","7894191325761780537333123063289076890","8317168622587749252157644151980184241","8247608713958241739319513369757942202","6709262435694589334365842164607334740","9976190983402503913516323687989652454","3973298224996190176126420259046461552","8806417199436666558713135615816932961","6785770154976665761453680012904084760","1629496065237541753588948822087696945","7630248757188414351567669972901297433","5984133405665713753901096870352784866","6228796408873168482969663804073624220","6579818522225704020965158491806257535","1178630188251743034686597647830473469","4206752599216946407253882303392593642","0597320439103059206361746130786557593","1168473439280891050956681902854711876","7939641670198339763026851412273645530","5868652390591617991649786692727887976","2217020391371547960527152809126273687","3904780667229290533211774784247422209","2861854974464513206397493017402268122","7510336067615660225556138461375522173","2011552793755263197745066132225785989","5366166088876503059330037687427964242","1846510704511455750716426618678158687","4891788802345229557825221122142109236","2632060044642035538679105104187254585"}
2
Returns: 39
{"9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999"}
0
Returns: 1
{"9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999","9999999999999999999999999999999999999999"}
10
Returns: 221
{"9999999999888888888877777777776666666666","8888888888777777777766666666665555555555","8888888888777777777766666666665555555555","8888888888777777777766666666665555555555","8888888888777777777766666666665555555555","8888888888777777777766666666665555555555","8888888888777777777766666666665555555555","8888888888777777777766666666665555555555","8888888888777777777766666666665555555555","8888888888777777777766666666665555555555","8888888888777777777766666666665555555555","7777777777666666666655555555554444444444","7777777777666666666655555555554444444444","7777777777666666666655555555554444444444","7777777777666666666655555555554444444444","7777777777666666666655555555554444444444","7777777777666666666655555555554444444444","7777777777666666666655555555554444444444","7777777777666666666655555555554444444444","7777777777666666666655555555554444444444","7777777777666666666655555555554444444444","6666666666555555555544444444443333333333","6666666666555555555544444444443333333333","6666666666555555555544444444443333333333","6666666666555555555544444444443333333333","6666666666555555555544444444443333333333","6666666666555555555544444444443333333333","6666666666555555555544444444443333333333","6666666666555555555544444444443333333333","6666666666555555555544444444443333333333","6666666666555555555544444444443333333333","5555555555444444444433333333332222222222","5555555555444444444433333333332222222222","5555555555444444444433333333332222222222","5555555555444444444433333333332222222222","5555555555444444444433333333332222222222","5555555555444444444433333333332222222222","5555555555444444444433333333332222222222","5555555555444444444433333333332222222222","5555555555444444444433333333332222222222"}
10
Returns: 1600
{ "5565236785012472", "3469912625904101", "5943545942017700", "9109166568720711", "6136079994373860", "4129136148916755", "2975832922074121", "4674050103662805", "2494729679116165", "1611964958059846", "2384128690120444", "1010697089697114", "0089682613597732", "4971774663111966", "8543141293776080", "4298494798935152", "5202757354375791", "5376161470010537", "5696381123743171", "1446566116127226" }
10
Returns: 32
{ "5555555555555555555555555555555555555555", "5555555555555555555555555555555555555555", "5555555555555555555555555555555555555555", "5555555555555555555555555555555555555555", "5555555555555555555555555555555555555555", "5555555555555555555555555555555555555555", "5555555555555555555555555555555555555555", "5555555555555555555555555555555555555555", "5555555555555555555555555555555555555555", "5555555555555555555555555555555555555555", "5555555555555555555555555555555555555555", "5555555555555555555555555555555555555555", "5555555555555555555555555555555555555555", "5555555555555555555555555555555555555555", "5555555555555555555555555555555555555555", "5555555555555555555555555555555555555555", "5555555555555555555555555555555555555555", "5555555555555555555555555555555555555555", "5555555555555555555555555555555555555555", "5555555555555555555555555555555555555555", "5555555555555555555555555555555555555555", "5555555555555555555555555555555555555555", "5555555555555555555555555555555555555555", "5555555555555555555555555555555555555555", "5555555555555555555555555555555555555555", "5555555555555555555555555555555555555555", "5555555555555555555555555555555555555555", "5555555555555555555555555555555555555555", "5555555555555555555555555555555555555555", "5555555555555555555555555555555555555555", "5555555555555555555555555555555555555555", "5555555555555555555555555555555555555555", "5555555555555555555555555555555555555555", "5555555555555555555555555555555555555555", "5555555555555555555555555555555555555555", "5555555555555555555555555555555555555555", "5555555555555555555555555555555555555555", "5555555555555555555555555555555555555555", "5555555555555555555555555555555555555555", "5555555555555555555555555555555555555555" }
10
Returns: 221
{ "1111111111", "1111111111", "2222222222", "3333333333", "4444444444", "5555555555", "6666666666", "5555555555", "1234567890", "1234567890", "1234567890", "1234567890", "1111111111", "1111111111" }
3
Returns: 113
{ "9999888877776666555544443333222211110000", "9999888877776666555544443333222211110000", "9999888877776666555544443333222211110000", "9999888877776666555544443333222211110000", "9999888877776666555544443333222211110000", "9999888877776666555544443333222211110000", "9999888877776666555544443333222211110000", "9999888877776666555544443333222211110000", "9999888877776666555544443333222211110000", "9999888877776666555544443333222211110000", "9999888877776666555544443333222211110000", "9999888877776666555544443333222211110000", "9999888877776666555544443333222211110000", "9999888877776666555544443333222211110000", "9999888877776666555544443333222211110000", "9999888877776666555544443333222211110000", "9999888877776666555544443333222211110000", "9999888877776666555544443333222211110000", "9999888877776666555544443333222211110000", "9999888877776666555544443333222211110000", "9999888877776666555544443333222211110000", "9999888877776666555544443333222211110000", "9999888877776666555544443333222211110000", "9999888877776666555544443333222211110000", "9999888877776666555544443333222211110000", "9999888877776666555544443333222211110000", "9999888877776666555544443333222211110000", "9999888877776666555544443333222211110000", "9999888877776666555544443333222211110000", "9999888877776666555544443333222211110000", "9999888877776666555544443333222211110000", "9999888877776666555544443333222211110000", "9999888877776666555544443333222211110000", "9999888877776666555544443333222211110000", "9999888877776666555544443333222211110000", "9999888877776666555544443333222211110000", "9999888877776666555544443333222211110000", "9999888877776666555544443333222211110000", "9999888877776666555544443333222211110000", "9999888877776666555544443333222211110000" }
10
Returns: 1503
{ "1234567890123456789012345678901234567890", "1234567890123456789012345678901234567890", "1234567890123456789012345678901234567890", "1234567890123456789012345678901234567890", "1234567890123456789012345678901234567890", "1234567890123456789012345678901234567890", "1234567890123456789012345678901234567890", "1234567890123456789012345678901234567890", "1234567890123456789012345678901234567890", "1234567890123456789012345678901234567890", "1234567890123456789012345678901234567890", "1234567890123456789012345678901234567890", "1234567890123456789012345678901234567890", "1234567890123456789012345678901234567890", "1234567890123456789012345678901234567890", "1234567890123456789012345678901234567890", "1234567890123456789012345678901234567890", "1234567890123456789012345678901234567890", "1234567890123456789012345678901234567890", "1234567890123456789012345678901234567890", "1234567890123456789012345678901234567890", "1234567890123456789012345678901234567890", "1234567890123456789012345678901234567890", "1234567890123456789012345678901234567890", "1234567890123456789012345678901234567890", "1234567890123456789012345678901234567890", "1234567890123456789012345678901234567890", "1234567890123456789012345678901234567890", "1234567890123456789012345678901234567890", "1234567890123456789012345678901234567890", "1234567890123456789012345678901234567890", "1234567890123456789012345678901234567890", "1234567890123456789012345678901234567890", "1234567890123456789012345678901234567890", "1234567890123456789012345678901234567890", "1234567890123456789012345678901234567890", "1234567890123456789012345678901234567890", "1234567890123456789012345678901234567890", "1234567890123456789012345678901234567890", "1234567890123456789012345678901234567890" }
2
Returns: 238
{ "0000000000", "0111111110", "0122222210", "0123333210", "0123443210", "0123443210", "0123333210", "0122222210", "0111111110", "0000000000" }
1
Returns: 95
{ "0000000000000000000000000000000000000000", "0001122233344532887533219994432563981737", "7652856182764512892569285598289754798452", "4574290415296502496429765212349759204957", "4287597459078147905249745942596254902955", "9876543219876543219876543219876544433211", "9433499259825752759952775295429274661561", "1026405162045962983943749120374905491245", "0000000000000000000000000000000000000000", "0001122233344532887533219994432563981737", "7652856182764512892569285598289754798452", "4574290415296502496429765212349759204957", "4287597459078147905249745942596254902955", "9876543219876543219876543219876544433211", "9433499259825752759952775295429274661561", "1026405162045962983943749120374905491245", "0000000000000000000000000000000000000000", "0001122233344532887533219994432563981737", "7652856182764512892569285598289754798452", "4574290415296502496429765212349759204957", "4287597459078147905249745942596254902955", "9876543219876543219876543219876544433211", "9433499259825752759952775295429274661561", "1026405162045962983943749120374905491245", "0000000000000000000000000000000000000000", "0001122233344532887533219994432563981737", "7652856182764512892569285598289754798452", "4574290415296502496429765212349759204957", "4287597459078147905249745942596254902955", "9876543219876543219876543219876544433211", "9433499259825752759952775295429274661561", "1026405162045962983943749120374905491245", "0000000000000000000000000000000000000000", "0001122233344532887533219994432563981737", "7652856182764512892569285598289754798452", "4574290415296502496429765212349759204957", "4287597459078147905249745942596254902955", "9876543219876543219876543219876544433211", "9433499259825752759952775295429274661561", "1026405162045962983943749120374905491245" }
4
Returns: 84
{ "55", "55" }
9
Returns: 4
{ "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000" }
10
Returns: 221
{ "6666666666666666666666666666666666666666", "6666666666666666666666666666666666666666", "6666666666666666666666666666666666666666", "6666666666666666666666666666666666666666", "6666666666666666666666666666666666666666", "6666666666666666666666666666666666666666", "6666666666666666666666666666666666666666", "6666666666666666666666666666666666666666", "6666666666666666666666666666666666666666", "6666666666666666666666666666666666666666", "6666666666666666666666666666666666666666", "6666666666666666666666666666666666666666", "6666666666666666666666666666666666666666", "6666666666666666666666666666666666666666", "6666666666666666666666666666666666666666", "6666666666666666666666666666666666666666", "6666666666666666666666666666666666666666", "6666666666666666666666666666666666666666", "6666666666666666666666666666666666666666", "6666666666666666666666666666666666666666", "6666666666666666666666666666666666666666", "6666666666666666666666666666666666666666", "6666666666666666666666666666666666666666", "6666666666666666666666666666666666666666", "6666666666666666666666666666666666666666", "6666666666666666666666666666666666666666", "6666666666666666666666666666666666666666", "6666666666666666666666666666666666666666", "6666666666666666666666666666666666666666", "6666666666666666666666666666666666666666", "6666666666666666666666666666666666666666", "6666666666666666666666666666666666666666", "6666666666666666666666666666666666666666", "6666666666666666666666666666666666666666", "6666666666666666666666666666666666666666", "6666666666666666666666666666666666666666", "6666666666666666666666666666666666666666", "6666666666666666666666666666666666666666", "6666666666666666666666666666666666666666", "6666666666666666666666666666666666666666" }
6
Returns: 85
{ "552555555555255", "552555555555255" }
3
Returns: 14
{ "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0011111111111111111111111111111111111100", "0011111111111111111111111111111111111100", "0011222222222222222222222222222222221100", "0011222222222222222222222222222222221100", "0011223333333333333333333333333333221100", "0011223333333333333333333333333333221100", "0011223344444444444444444444444433221100", "0011223344444444444444444444444433221100", "0011223344555555555555555555554433221100", "0011223344555555555555555555554433221100", "0011223344556666666666666666554433221100", "0011223344556666666666666666554433221100", "0011223344556677777777777766554433221100", "0011223344556677777777777766554433221100", "0011223344556677888888887766554433221100", "0011223344556677888888887766554433221100", "0011223344556677889999887766554433221100", "0011223344556677889999887766554433221100", "0011223344556677889999887766554433221100", "0011223344556677889999887766554433221100", "0011223344556677888888887766554433221100", "0011223344556677888888887766554433221100", "0011223344556677777777777766554433221100", "0011223344556677777777777766554433221100", "0011223344556666666666666666554433221100", "0011223344556666666666666666554433221100", "0011223344555555555555555555554433221100", "0011223344555555555555555555554433221100", "0011223344444444444444444444444433221100", "0011223344444444444444444444444433221100", "0011223333333333333333333333333333221100", "0011223333333333333333333333333333221100", "0011222222222222222222222222222222221100", "0011222222222222222222222222222222221100", "0011111111111111111111111111111111111100", "0011111111111111111111111111111111111100", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000" }
10
Returns: 1600
{ "0123456789987654321001234567899876543210", "0123456789987654321001234567899876543210", "0123456789987654321001234567899876543210", "0123456789987654321001234567899876543210", "0123456789987654321001234567899876543210", "0123456789987654321001234567899876543210", "0123456789987654321001234567899876543210", "0123456789987654321001234567899876543210", "0123456789987654321001234567899876543210", "0123456789987654321001234567899876543210", "0123456789987654321001234567899876543210", "0123456789987654321001234567899876543210", "0123456789987654321001234567899876543210", "0123456789987654321001234567899876543210", "0123456789987654321001234567899876543210", "0123456789987654321001234567899876543210", "0123456789987654321001234567899876543210", "0123456789987654321001234567899876543210", "0123456789987654321001234567899876543210", "0123456789987654321001234567899876543210", "8888888888888888888888888888888888888888", "8888888888888888888888888888888888888888", "8888888888888888888888888888888888888888", "8888888888888888888888888888888888888888", "8888888888888888888888888888888888888888", "8888888888888888888888888888888888888888", "8888888888888888888888888888888888888888", "7777777777777777777700000000000000000000", "7777777777777777777700000000000000000000", "7777777777777777777700000000000000000000", "7777777777777777777700000000000000000000", "7777777777777777777700000000000000000000", "7777777777777777777700000000000000000000", "7777777777777777777700000000000000000000", "3865938602386593860238659386023865938602", "3865938602386593860238659386023865938602", "3865938602386593860238659386023865938602", "3865938602386593860238659386023865938602", "3865938602386593860238659386023865938602", "3865938602386593860238659386023865938602" }
10
Returns: 817
{ "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000111111111111111111110000000000", "0000000000111111111111111111110000000000", "0000000000111111111111111111110000000000", "0000000000111111111111111111110000000000", "0000000000111111111111111111110000000000", "0000000000111111111111111111110000000000", "0000000000111111111111111111110000000000", "0000000000111111111111111111110000000000", "0000000000111111111111111111110000000000", "0000000000111111111111111111110000000000", "0000000000111112222222222111110000000000", "0000000000111112222222222111110000000000", "0000000000111112222222222111110000000000", "0000000000111112222222222111110000000000", "0000000000111112222222222111110000000000", "0000000000111112222222222111110000000000", "0000000000111112222222222111110000000000", "0000000000111112222222222111110000000000", "0000000000111112222222222111110000000000", "0000000000111112222222222111110000000000", "0000000000111111111111111111110000000000", "0000000000111111111111111111110000000000", "0000000000111111111111111111110000000000", "0000000000111111111111111111110000000000", "0000000000111111111111111111110000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000" }
10
Returns: 1378
{ "5565236785012472", "3469912625904101", "5943545942017700", "9109166568720711", "6136079994373860", "4129136148916755", "2975832922074121", "4674050103662805", "2494729679116165", "1611964958059846", "2384128690120444", "1010697089697114", "0089682613597732", "4971774663111966", "8543141293776080", "4298494798935152", "5202757354375791", "5376161470010537", "5696381123743171", "1446566116127226" }
2
Returns: 32
{ "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111" }
10
Returns: 221
{ "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111", "1111111111111111111111111111111111111111" }
10
Returns: 408
{ "123456789999999999999999999999987654321", "123456789999999999999999999999987654321", "123456789999999999999999999999987654321", "123456789999999999999999999999987654321", "123456789999999999999999999999987654321", "123456789999999999999999999999987654321", "123456789999999999999999999999987654321", "123456789999999999999999999999987654321", "123456789999999999999999999999987654321", "123456789999999999999999999999987654321", "123456789999999999999999999999987654321", "123456789999999999999999999999987654321", "123456789999999999999999999999987654321", "123456789999999999999999999999987654321", "123456789999999999999999999999987654321", "123456789999999999999999999999987654321", "123456789999999999999999999999987654321", "123456789999999999999999999999987654321", "123456789999999999999999999999987654321", "123456789999999999999999999999987654321", "123456789999999999999999999999987654321", "123456789999999999999999999999987654321", "123456789999999999999999999999987654321", "123456789999999999999999999999987654321", "123456789999999999999999999999987654321", "123456789999999999999999999999987654321", "123456789999999999999999999999987654321", "123456789999999999999999999999987654321", "123456789999999999999999999999987654321", "123456789999999999999999999999987654321", "123456789999999999999999999999987654321", "123456789999999999999999999999987654321", "123456789999999999999999999999987654321", "123456789999999999999999999999987654321", "123456789999999999999999999999987654321", "123456789999999999999999999999987654321", "123456789999999999999999999999987654321", "123456789999999999999999999999987654321", "123456789999999999999999999999987654321", "123456789999999999999999999999987654321" }
10
Returns: 523
{ "0005000", "0005000", "0055000", "5555555", "0005000", "0005000", "0005000" }
3
Returns: 49