Sort by

recency

|

81 Discussions

|

  • + 0 comments

    python3

    n = int(input())
    s = str(bin(n))
    l = []
    ss = 0
    for i in s:
        if i == '1':
            ss += 1
            l.append(ss)
        elif i == '0':
            ss = 0
    print(max(l))
    
  • + 0 comments

    hi

    this problem solution can be optimize further. here is the trick to solve this problem in O(K).

    https://youtu.be/bc7cxeDy308

  • + 2 comments

    Those who are looking for javascript solution

    const n = parseInt(readLine(), 10);
        
        let count = 0;
        let result = 0;
        let arr = n.toString(2);
        for(let i = 0; i< arr.length; i++) {
            if(arr[i] == 0) {
                count = 0;
            } else {
                count++;
                result = Math.max(result, count)
            }
    
        }
        console.log(result)
    
  • + 1 comment

    Stack stack=new Stack(); int count=1,i=-1,max=0; while(n!=0) { stack.push(n%2); n=n/2; } while(!stack.isEmpty()) { if(stack.peek()==i) { count++; }

            if(max<count)
            {
                max=count;
            }
            i=stack.peek();
    
            if(i==0)
            {
                count=1;
            }
            stack.pop();
        }
    
  • + 0 comments

    When we state real estate logos design, we mean a brand mark which has a capacity to impart in the interest of their business to the world. It's anything but a medium-term work for it requires a broad research work about the most recent real estate logo design patterns and contender's image imprint to think of something that is one of a kind, captivating and eye-getting.