• + 3 comments

    when i ran my code only sample test cleared and rest failed

    function circularArrayRotation(a, k, queries) { 
    
        var res = [];
        var resind = 0;
    
        while (k > 0) {
            rotateArr();
            k--;
        }
    
        function rotateArr() {
            var i = 0;
            var lastel = a[a.length - 1];
            var temp1 = a[0];
            var temp2;
    
            while (i < a.length-1) {
                temp2 = a[i + 1];
                a[i + 1] = temp1;
                temp1 = temp2;
                i++;
            }
    
            a[0] = lastel;
        }
    
        for(var j in queries) {
            res[resind] = a[j];
            resind++;
        }
    
        return res;
    		}
    
        I think some issue is in how i am returning the values, please help identify the error