Update appNew update is available. Click here to update.
About
Coding enthusiast, Frontend web developer, familiar with JAVAand C language.
JECRC University 2024
Java - Default language
My Stats
EXP gained
yellow-spark
11048
Level
7 (Expert)
Community stats
Discussions
0
Upvotes
0
Know more
199
Total problems solved
132
Easy
66
Moderate
1
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:

0 days

Longest streak:

41 days

Less

More

Achievements
6
Ronin
Topics
Stacks & Queues
Trees
Strings
+ 3 more
2
Samurai
Topics
Arrays
Linked List
Discussions
java solution
Interview problems

 

public class Solution {

    public static void mirrorTree(BinaryTreeNode node) {

        // Write your code here.

        if(node==null) return;

        if(node!=null){

            BinaryTreeNode temp=node.left;

            node.left=node.right;

            node.right=temp;

        }

        mirrorTree(node.left);

        mirrorTree(node.right);

    }

}

profile
Khushi2329
Published On 17-Sep-2023
14 views
0 replies
0 upvotes
java solution
Interview problems

public class Solution {

    public static int[] searchRange(int []arr, int x) {

        // Write your code here.

        int ans[]=new int[2];

        int fo=-1;

        int lo=-1;

       int s=0;

       int l=arr.length-1;

       int mid=0;

       while(s<=l){

           mid=(s+l)/2;

           if(x>arr[mid]) s=mid+1;

           else if(x<arr[mid]) l=mid-1;

           else{

               if(arr[s]==x&&arr[l]==x){

                   fo=s;

                   lo=l;

                   break;

               }

               else if(arr[s]==x){

                   fo=s;

                   l--;

               }

               else{

                    lo=l;

                    s++;}

           }

       }

ans[0]=fo;

ans[1]=lo;

return ans;

    }

}

profile
Khushi2329
Published On 13-Sep-2023
85 views
0 replies
0 upvotes