5 kyu

Hex Dump

199 of 262anter69
Description
Loading description...
Algorithms
  • Please sign in or sign up to leave a comment.
  • dfhwze Avatar

    What's with the white spaces?

    '00000000: 99 11 6a 07 c8 79 26 cb 31 96 d1 24 d0 40 3c 1f  ..j..y&.1..$.@<.\n00000010: 0c 02 09 0a d4 4b 44 ea b2 84 31 30 a9 18 ef 20  .....KD...10...\n00000020: 52 c3 09                                         R..' should equal '00000000: 99 11 6a 07 c8 79 26 cb 31 96 d1 24 d0 40 3c 1f  ..j..y&.1..$.@<.\n00000010: 0c 02 09 0a d4 4b 44 ea b2 84 31 30 a9 18 ef 20  .....KD...10... \n00000020: 52 c3 09                                         R..'
    
  • ahmet_popaj Avatar

    Nice one, well done.

  • FArekkusu Avatar

    Sample tests are not using it blocks in Python.

  • tweller Avatar

    I'm trying the C++ version. The test is fine, but on my attempt, I get

    In file included from main.cpp:7:
    ./tests.cpp:79:13: error: no template named 'vector'; did you mean 'std::vector'?
          const vector<char> originalFull_Data(full_byte_data);
                ^~~~~~
                std::vector
    

    Note that this is in tests.cpp, not main.cpp.

  • FArekkusu Avatar

    The bytes should be represented with std::vector<unsigned char> instead of std::vector<char> in C++.

  • FArekkusu Avatar

    Input should be passed as const & in C++.

  • FArekkusu Avatar

    Random tests for dehex can be cheated in C++.

  • FArekkusu Avatar

    sByte should be defined in files where it's actually used in C++.

  • FArekkusu Avatar

    Sample and final tests are missing required headers in C++.

  • ElectricZatch Avatar

    Posted a C++ translation for this Kata. Its my first translation, so I hope I did it right!

  • dinglemouse Avatar

    For Java, I think there an un-tested edge case which I saw happen very rarely in the random tests.

    When the final byte(s) of the data are spaces (0x20) it seems the RHS text part is not supposed to be trimmed (for those bytes).

    In other words, there is a subtle un-tested distinction between spaces which should be trimmed (when last line > bytes) and spaces which should not be trimmed (when last data is 0x20)....

  • Mohrezakhorasany Avatar

    It was awsome kata, it took me two days to solve it :) Thanks for sharing it

  • Mohrezakhorasany Avatar

    On the random tests, we have this one:

    00000000: d3 81 8d bf d3 8d 2c b3 cf 7a 5c 40 8c 7b c1 9a ......,..z@.{.. 00000010: 4e 2a 40 84 19 7e 41 c0 81 91 b6 f6 e3 0d 2f c5 N*@..~A......./. 00000020: 86 7d a7 88 82 21 1f 63 f3 f5 9d a9 93 78 78 16 .}...!.c.....xx. 00000030: 64 76 93

    I logged the size of the byte array, it's 48, where are the last 3 showing up?

    this is mine:

    00000000: d3 81 8d bf d3 8d 2c b3 cf 7a 5c 40 8c 7b c1 9a ......,..z@.{.. 00000010: 4e 2a 40 84 19 7e 41 c0 81 91 b6 f6 e3 0d 2f c5 N*@..~A......./. 00000020: 86 7d a7 88 82 21 1f 63 f3 f5 9d a9 93 78 78 16 .}...!.c.....xx.

  • jeanfrancoishayon Avatar

    Hello, i don't see how transform 1a 2b in b'\x1a\x2b' because the '\' is forbiden in string (need two \)

  • opitt-KS Avatar

    Nice Kata! I learned about bytes class. I ignored so far in my journey. Thank you!

  • user9526662 Avatar

    how does the memory address works? like... hex number 1 should be: 00000001, but in the test cases it is 00000010

  • G_kuldeep Avatar

    this kata is lowerranked i think..btw great kata ;-)

  • lechevalier Avatar

    Memory address uses lowercase or uppercase for hexadecimal numbers?

  • Blind4Basics Avatar

    found in the random tests:

    00000680: 28 cd 96 dd 88 5c 5e 35 18 55 cd 09 12 cc a8 eb  (....\^5.U......
    00000690: 7f 8d 5f c1 5d a9 34 80 08 71 79 d3 48 2c 27 5a  ._.].4..qy.H,'Z
    000006a0: 9b d4 70 dd 82 f0 77 6c 18 ab 76 40 ad 29 97 02  ..p...wl..v@.)..
    000006b0: f0 3d cc e4 59 79 06 6c 2a c1 c7 76 bc 10 7e f6  .=..Yy.l*..v..~.
    000006c0: 19 92 cd 23 16 5a 9b bc b8 80 75 87 04 7f 10 9e  ...#.Z....u....
    

    line 2 and 5: you have unprintable chars instead of dots, it seems. When writing this message, I have 2 red points showing up instead of chars in those two lines where I put the X:

    00000680: 28 cd 96 dd 88 5c 5e 35 18 55 cd 09 12 cc a8 eb  (....\^5.U......
    00000690: 7f 8d 5f c1 5d a9 34 80 08 71 79 d3 48 2c 27 5a  X._.].4..qy.H,'Z
    000006a0: 9b d4 70 dd 82 f0 77 6c 18 ab 76 40 ad 29 97 02  ..p...wl..v@.)..
    000006b0: f0 3d cc e4 59 79 06 6c 2a c1 c7 76 bc 10 7e f6  .=..Yy.l*..v..~.
    000006c0: 19 92 cd 23 16 5a 9b bc b8 80 75 87 04 7f 10 9e  ...#.Z....u..X..
    
  • Blind4Basics Avatar

    This comment has been hidden.

  • Voile Avatar

    Approved ;-)

  • suic Avatar

    That was fun! Thanks, suic