Update appNew update is available. Click here to update.
About
Shri Guru Gobind Singhji Institute of Engineering and Technology, Nanded 2024
Java - Default language
My Stats
EXP gained
yellow-spark
16595
Level
7 (Expert)
Community stats
Discussions
0
Upvotes
8
Know more
565
Total problems solved
520
Easy
41
Moderate
4
Hard
0
Ninja
Jan Jan Feb Feb Mar Mar Apr Apr May May Jun Jun Jul Jul Aug Aug Sep Sep Oct Oct Nov Nov Dec Dec

Current streak:

14 days

Longest streak:

29 days

Less

More

Achievements
4
Ronin
Topics
Strings
Greedy
+ 2 more
2
Samurai
Topics
Arrays
Linked List

College monthly badge

1 Time topper

Shri Guru Gobind Singhji Institute of Engineering and Technology, Nanded

291 average partcipants
Discussions
Java Solution Easy
Careers and placements

public class Solution {

    public static int ninjaAndTriangle(int n) {

        // Write your code here.

        int i=0,level=0;

        while(n>=i){

            i++;

            n -= i;

            if(n>=0){

                level++;

            }else return level;

        }

        return level;

    }

}

profile
Pavan8010
Published On 25-Aug-2023
36 views
0 replies
1 upvotes
Java Solution Easy
Careers and placements

public class Solution {

    public static int ninjaAndTriangle(int n) {

        // Write your code here.

        int i=0,level=0;

        while(n>=i){

            i++;

            n -= i;

            if(n>=0){

                level++;

            }else return level;

        }

        return level;

    }

}

profile
Pavan8010
Published On 25-Aug-2023
36 views
0 replies
1 upvotes
Java Simple One Line Solution
Careers and placements

public class Solution {

    public static int toggleKBits(int n,int k) {

        // Write your code here.

        return (n ^ ((1<<k)-1));

    }

}

 

profile
Pavan8010
Published On 24-Aug-2023
62 views
0 replies
2 upvotes
Java Simple One Line Solution
Careers and placements

public class Solution {

    public static int toggleKBits(int n,int k) {

        // Write your code here.

        return (n ^ ((1<<k)-1));

    }

}

 

profile
Pavan8010
Published On 24-Aug-2023
62 views
0 replies
2 upvotes
Java Easy Solution using PriorityQueue🔥🔥
Careers and placements

import java.util.* ;

import java.io.*; 

 

public class Solution {

    public static ArrayList<Integer> findMinMax(int a, int b) {

        // Write your code here

        PriorityQueue<Integer> pq= new PriorityQueue<>();

        ArrayList<Integer> ans = new ArrayList<>();

        pq.add(a);

        pq.add(b);

        ans.add(pq.poll());

        ans.add(pq.poll());

        return ans;

    }

}

profile
Pavan8010
Published On 22-Aug-2023
103 views
1 replies
1 upvotes
Java Easy Solution using PriorityQueue🔥🔥
Careers and placements

import java.util.* ;

import java.io.*; 

 

public class Solution {

    public static ArrayList<Integer> findMinMax(int a, int b) {

        // Write your code here

        PriorityQueue<Integer> pq= new PriorityQueue<>();

        ArrayList<Integer> ans = new ArrayList<>();

        pq.add(a);

        pq.add(b);

        ans.add(pq.poll());

        ans.add(pq.poll());

        return ans;

    }

}

profile
Pavan8010
Published On 22-Aug-2023
103 views
1 replies
1 upvotes