Ad
  • Default User Avatar

    Thank you. I was about to skip this Kata. Until I saw your comment.

  • Default User Avatar

    Thank you for pointing it out. You were right.

    Turns out it was coming from somewhere else.

  • Default User Avatar

    So frustrating. I'm doing Java.

    What is the expected return value for getPrimeFactorPotencies(long n) with n = 0?

    I'm returning new Long[]{} and test fails with null pointer exception.

  • Default User Avatar

    The line is 1,4,6,4,1.
    Now build the sum with its squares.
    1² + 4² + 6² + 4² + 1² = 70.

  • Default User Avatar

    In case anyone is looking for Java's full implementation of TreeNode class. This will work:

    class TreeNode {
    	TreeNode left;
    	TreeNode right;
    	int value;
    
    	public TreeNode(int value) {
    		this.value = value;
    	}
    
    	public static TreeNode leaf(int value) {
    		return new TreeNode(value);
    	}
    
    	public TreeNode withLeaves(int leftVal, int rightVal) {
    		left = new TreeNode(leftVal);
    		right = new TreeNode(rightVal);
    		return this;
    	}
    
    	public static TreeNode join(int value, TreeNode leftNode, TreeNode rightNode) {
    		TreeNode node = new TreeNode(value);
    		node.left = leftNode;
    		node.right = rightNode;
    		return node;
    	}
    
    }
    
  • Default User Avatar

    This riddle is just plain evil.

  • Default User Avatar

    Thanks for this fun kata.

    Especially liked how nice test outputs look.

  • Default User Avatar

    Liked this one. Very interesting topic, teached me something new.

    As others have already mentioned: Test cases would really help out. Also it is part of a series, which should be mentioned.

    http://www.codewars.com/kata/genetic-algorithm-series-number-1-generate (Sadly none of them are available in java at this moment).

  • Default User Avatar

    My tip to anyone doing the java version: Just don't.

    What I stumbled upon:

    Input words: wqlq, mq, lb, , jt, e, fo, ej{, lhd, u

    expected: wqlq, mq, lb, [jt, e, fo, ej{, lhd and ]u

    Now mysteriously [ and ] characters appear out of nowhere?

    Can't be bothered with it.

  • Default User Avatar

    There is a problem with method's return type.

    Had to change the initial method from

    public static long[] divisibleBy(long[] numbers, long divider)
    

    to

    public static int[] divisibleBy(int[] numbers, int divider)
    

    for tests to pass.

  • Default User Avatar

    Java test cases still have wrong syntax.

    Use

      assertEquals("undefined",s.slope(new int[] {-7,2,-7,4}));
      assertEquals("5",s.slope(new int[] {10,50,30,150}));
      assertEquals("-5",s.slope(new int[] {15,45,12,60}));
      assertEquals("6",s.slope(new int[] {10,20,20,80}));
      assertEquals("undefined",s.slope(new int[] {-10,6,-10,3}));
    
  • Default User Avatar

    When doing java version what is the expected result for

    int n = 20

    double[] signature = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0} ?

    I'm returning double[] arr = {0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0} (20 times '0')

    Getting ArrayIndexOutOfBoundsException at assertArrayEquals().

  • Default User Avatar

    This is most likely a performance issue with the code.
    Some tests will take pretty long strings.
    Instead of string concat ( += ) try using StringBuilder.

  • Default User Avatar

    Test cases for java are broken.
    This can be fixed by simply renaming public class "Test"
    to anything other than "Test".

  • Default User Avatar

    Same issue

    "Request failed with status code 500"

  • Loading more items...