What's wrong with my CodeEval challenge solution? <p>I'm new to coding, and after doing some online tutorials I decided to do a few challenges on CodeEval, and just got the balls to try a hard one. I submitted my solution, and it says it's partially solved, and I just can't figure out what I'm doing wrong. I'm not sure if these challenges are something that I'm supposed to do 100% on my own, in which case I won't submit a solution that includes any input from people on here. I just want to know what I should do better.</p> <p>Here is the link to the challenge: <a href="https://www.codeeval.com/open_challenges/126/" rel="nofollow">https://www.codeeval.com/open_challenges/126/</a></p> <p>And here is my code (JavaScript):</p> <pre><code>function compareSegments(segment1, segment2) { var totalMisMatches = 0; for (var i = 0; i &lt; segment1.length; i++) { if (segment1[i] != segment2[i]) { totalMisMatches++; } } return totalMisMatches; } function makeInnerSegment(array, index, length) { var newArray = []; for (var j = 0; j &lt; length; j++) { newArray.push(array[index + j]); } return newArray; } function compare(a, b) { for (var i = 0; i &lt; a.length; i++) { if (a[i] &lt; b[i]) { return -1; } if (a[i] &gt; b[i]) { return 1; } } return 0; } function makeArrayOfPossibleSegments(array, segment, maxMismatches) { var newArray = []; for (var i = 0; i &lt;= array.length - segment.length; i++) { var innerSegment = makeInnerSegment(array, i, segment.length); var mismatches = compareSegments(segment, innerSegment); if (!(mismatches &gt; maxMismatches)) { innerSegment.unshift(mismatches); newArray.push(innerSegment); } } return newArray.sort(compare); } var fs = require("fs"); fs.readFileSync(process.argv[2]).toString().split('\n').forEach(function (line) { if (line !== "") { var output = ""; var splitArray = line.split(" "); var DNASegment = splitArray[0].split(""); var maxMisMatches = parseInt(splitArray[1]); var DNAString = splitArray[2].split(""); var possibleSegments = makeArrayOfPossibleSegments(DNAString, DNASegment, maxMisMatches); if (possibleSegments.length === 0) { output = "No match"; } else { for (var i = 0; i &lt; possibleSegments.length; i++) { for (var j = 1; j &lt; possibleSegments[i].length; j++) { output += possibleSegments[i][j]; } output += " "; } output = output.substring(0, output.length - 1) } console.log(output); } }); </code></pre>