Ad
  • Custom User Avatar

    Yes, for me it worked now. Thanks a lot!

  • Custom User Avatar

    Funny, it looks like the issue was fixed (https://github.com/Codewars/codewars-runner-cli/commit/59050f46dee6dd943e5c78cb4a0abadf1dd1cf33) but not pushed yet (2016-12-15 11:24 AM CET) to the servers used to test my submission.

  • Custom User Avatar

    The task for comp(n) should be rephrased:

    1. Given n (integer > 2)return the number of times where a term of u is less than its predecessor up to and including u(n). Call this last function comp(n)

    In my C solution (and yours, too), the loop goes to n, not u(n)

  • Custom User Avatar

    All tests pass (Time: 2457ms Passed: 9 Failed: 0) yet I can't submit my final solution. The only explanation I see is that there's output to STDERR, but these are all warnings for the content of the Test.hs file over which I have no control (?).

    I had to fix the examples to get rid of similar warnings.

    Can you please look at the Test.hs file and fix the warnings?

    STDERR:
    /tmp/haskell116119-18-1h3md2h.98bxs10pb9/RPN/Test.hs:9:5: Warning:
    Tab character
    ... snip same warning for lines
    ... 11, 13, 15, 17, 19, 21, 23, 25

  • Custom User Avatar

    All tests pass (Time: 3092ms Passed: 17 Failed: 0) yet I can't submit my final solution. The only explanation I see is that there's output to STDERR, but these are all warnings for the content of the Main.hs file over which I have no control (?).

    [Edit 2016-12-09:] I can run the examples and don't get these warnings.

    Can you please look at the Main.hs file and fix the warnings?

    STDERR:
    /tmp/haskell116117-18-czqumu.62eoupu8fr/Main.hs:7:1: Warning:
    Tab character
    ... snip same warning for lines
    ... 8, 9, 10, 11, 17, 18, 19, 60, 61, 62, 63, 64, 65, 66, 67, 68, 71 and 72

  • Custom User Avatar

    I had the same problem with random testing using k < 1.

    In the end, I got an ugly solution working...

    Here are the test cases I gathered while working on it, so you have an idea what kind of values QuickCheck generates and which answers to expect

    it "reverse engineers specs implied by random tests" $ do
      let posExa xs k e = josephus xs k `shouldBe` e -- these functions were used as shorthand for negative and positive examples
      let negExa xs k e = josephus xs k `shouldNotBe` e
      josephus "" (- 1) `shouldBe` ""
      josephus "abc" (- 1) `shouldBe` "bca" -- validated?
      -- examples from quickcheck
      posExa "aba" (- 2) "aab"
      posExa "aba" (- 3) "aab"
      posExa "abc" (- 3) "cab"
      posExa "aab" (- 3) "baa"
      posExa "aba" (- 4) "baa"
      posExa "aab" (- 4) "aab"
      posExa "aab" (- 5) "aab"
      posExa "aab" (- 6) "baa"
      posExa "aaab" (- 2) "aaab"
      posExa "Z,n>ToWV" (- 52) ">V,oTZWn"
      posExa "W{VZ" (- 11) "W{VZ"
      posExa "A>Ba" (- 6) ">AaB"
      posExa "" (- 6) ""
      posExa "%0f!" (- 9) "f0!%"
      posExa "WTZBt" (- 3) "TZWBt"
      posExa "(qWQrUMT" (- 36) "Qq(MUrWT"
      posExa "Zo" (- 36) "oZ"
      posExa "V=TfnnQP" (- 17) "QTfPnnV="
      posExa "Tq9QPUA>V$" (- 17) "9QTA>qV$PU"
      posExa "(qWQrUMT" (- 36) "Qq(MUrWT"
      posExa "[sTVQ PR=OS~YZX31l" (- 37) "1YP3V TZ[XQ~OsSR=l"
      posExa "VPRBKg-sYDTQbH/gzdrSce" (- 16) "gT/dScrgQ-VYzPeDHsKRbB"
      posExa "~PJcOvl~VgRn:E)Sy_avtfb}KT{ei]C" (- 18) ":KOSTJRa}]PvlcC{vneEtbf)i_~gV~y"
      posExa "ZW)VaCXabmZyd" (- 6) "XdamZ)VWZCyba"
      posExa "abc" (- 14) "acb"
      posExa "dI{\181\133\GSf[f\SOHMTw\NUL" (- 4) "\SOH\133\NUL[Ifd\GSMTf{w\181"
      posExa "\230\\\145" (- 3) "\145\230\\"
      posExa "UC\SOH\ACKV" (- 8) "CU\SOHV\ACK"
      posExa "dI{\181\133\GSf[f\SOHMTw\NUL" (- 4) "\SOH\133\NUL[Ifd\GSMTf{w\181"
      posExa "\146z\228e\183\ACK.nW7\231M" (- 14) "7\ACK\146\183n.z\228W\231eM"
      posExa "T\143\f_" (- 17) "\f_T\143"
      posExa "\253m\160\&2V\DC3\246J\172\SYN G\219" (- 9) "2\246\172\SYNJV\253\DC3 m\219\160G"
      posExa "Y\ENQZQ" (- 4) "Q\ENQYZ"
      posExa "" (- 19) ""
      posExa "\ACK\229I\ACK.+/\131=\bF)w\a\r\253" (- 4) ")/\229w+\253=\ACK\131\aI\ACK\r\b.F"
      posExa "*9\148\NAKL:\tD\ENQV\226o\226\152j\242\148\NUL#B\172" (- 26) "\242\ENQ*o\172\t\226j\152D9:V\148L#\148B\NAK\NUL\226"
      posExa "cX\142*{#+\DLEe(\ACKY\251,f\234\&1 " (- 7) "\ACK\142\251*Yc\DLEf {#X\234e(1+,"
      posExa "\205;\195(\232cL`\171\252`\ETBt]w.\236touND\212\GS\238\237\DC2" (- 1) "\237\GSDut.]\ETB\252`c(;\DC2\212ow`L\195\238\236\171\205tN\232"
      posExa ",#\186S><3XQ\DC4\FS\162{\n\235\&2`" (- 2) "\235\162Q<\186`{XS2\DC4#\FS,>\n3"
      posExa "W\SOHM\157\140\132|./\246\182\DC3a" (- 32) "|\182\DC3.Wa\157\246\140M\132\SOH/"
      posExa "e\217+\196\&1\RSD}\187\f\223\US#*j\229\135\247\240N\140\177bc\235\\X\130Ll\240" (- 31) "\240L\\\177\135\223\196c#ej\130}\229N\140\247\187lD\US\RS\235X\f+b\217*\240\&1"
      posExa "\183f8\214r*L9L\205+]M\182\223-p\253h\r\232\187_\217\224\GS{\252" (- 25) "8r*\214\183\GS\187p+{-f\182\232\224\252_\223LL\217]9\r\253\205Mh"
      posExa "+\ETB6\131}\ETBN1i\199\f\228U\191#\136\DC2\236c\RS\204h\ESC;" (- 36) "\228h\ETBU\DC2c\236\191N\ESC}\199i\ETB\f1\204\136#6+;\RS\131"
      posExa "\rG7\163\151-<\189 0\n:\DC2g\SO\vH\173r" (- 52) "\151<\163\173\&0g\DC2-\n7 H\189\SO\rr:G\v"
      posExa "\rQ-\ETXt\238\213\200V@\aD4H`" (- 34) "\a\ETXVD\200Qt`\r\238\213\&4-H@"
      -- negative examples from quickcheck
      negExa "aba" (- 4) "aba"
      negExa "aab" (- 4) "aba"
      negExa "aab" (- 4) "baa"
      negExa "aab" (- 6) "aba"
      negExa "aab" (- 6) "aab"
      negExa "aab" (- 7) "baa"
      negExa "aba" (- 5) "baa"
      negExa "aaba" (- 1) "abaa"
      negExa "aaab" (- 3) "aaab"
    
  • Custom User Avatar

    Add test cases to "prevent" solutions like https://www.codewars.com/kata/reviews/5486115fd8325ec04c0001ea/groups/55988c1318b9e971f300001a or https://www.codewars.com/kata/reviews/5486115fd8325ec04c0001ea/groups/57cd9854fa9fc50f580002b7 which do not preserve the order of the input strings.

    E.g. lcs "12345" "45321" == "45"

    Also, a property test could be added to verify that lcs x y == lcs y x