Homework Solution: unique characters, return null. function firstUniqueC ip…

    I need help solving this question. It just has a bug and I cant find it. H CODING HIRE Problem Statement Coding Area 1function firstunique(input) 2 Given a string, return the first non-repeated character. If there are no unique characters, return null forCvar i-0;i<input.length-1;i++) var char1 = input. charAt(i); var found false for(var j-0汀<input.length;j++) { if(j=i) continue ; var char2 = input, charAt(j); if(char1 char2) { 10 found = true; break; 12 13 14 15 16 17 18 ifC!found) return char1; Fix the code so the tests pass → Test Cases return null; abbccfbb Thats an exact duplicate of another case, please modify it. input abcab Add Case expected output actual output null null aabbc null abbccfbb 咄面 case was a passing, you need to add a failing case.
    Given a string, return the first non-repeated character. If there are no unique characters, return null. function firstUniqueC ipu) { for(var i = 0;i

    Expert Answer

    The first for loop should be iterated till i

    I deficiency aid solving this interrogation. It true has a bug and I jangle confront it.

    H CODING HIRE Problem Statement Coding Area 1administration primaryunique(input) 2 Given a string, restore the primary non-repeated species. If there are no choice speciess, restore trifling restraintCvar i-0;i<input.length-1;i++) var char1 = input. charAt(i); var rest bogus restraint(var j-0汀<input.length;j++) { if(j=i) remain ; var char2 = input, charAt(j); if(char1 char2) { 10 rest = true; break; 12 13 14 15 16 17 18 ifC!found) restore char1; Fix the command so the examinations ignoring → Examination Contingencys restore trifling; abbccfbb Thats an exact counterfeit of another contingency, delight change it. input abcab Gather Contingency expected output developed output trifling trifling aabbc trifling abbccfbb 咄面 contingency was a ignoringing, you deficiency to gather a irresolute contingency.

    Given a string, restore the primary non-repeated species. If there are no choice speciess, restore trifling. administration primaryUniqueC ipu) { restraint(var i = 0;i

    Expert Tally

    The primary restraint loop should be iterated cultivate input.length-1 (Means if input’s tediousness is 5 as in examination contingency “aabbc” the loop should definite cultivate 4) . The examination contingency “aabbc” is irresolute accordingly the loop never iterates to the definite appreciate. So , gather a correspondent symbol in the requisite of primary restraint loop.

    administration primaryUnique(input) {
    for(var i=0;i<=input.length-1;i++){
    var char1=input.charAt(i);
    var rest=false;
    for(var j=0;j<input.length;j++){
    if(i==j){
    continue;
    }
    var char2=input.charAt(j);
    if(char1==char2){
    found=true;
    break;
    }
    }
    if(!found){
    restore char1;
    }
    }
    restore trifling;
    }