Given an integer array arr[] of size n which contains only 1 and 0. Your task is to make the array perfect. An array is said to be perfect if for each i from 0 to n-1 arr[i]==arr[n-1-i] is satisfied.
To Make the array perfect you are allowed to do the following operation :
In one operation you can choose two different indexes i and j and set value of both arr[i] and arr[j] to arr[i]^arr[j].
Your task is to make the array perfect in minimum possible number of operations and return the number of operations.
Note: 0-based indexing is used.
0:00 Introduction
0:15 Problem Statement
1:18 White Board Explanation
4:38 Complexity Analysis
5:00 C++ Code
6:35 Java Code
gfg potd
gfg potd today
gfg problem of the day
My DSA Journey:- https://youtu.be/quZBBv12mCQ
How to Earn By GFG Articles:- https://youtu.be/XjvEgkd49Gk
Problem Link:-https://practice.geeksforgeeks.org/problems/ed0422e992899f3f46340ce97b0090683ceebd67/1
Code Link:-https://github.com/ShubhamKashyap138/Data-Structure/blob/main/Bit%20Magic
Playlist Link:-https://youtube.com/playlist?list=PLq3GlRZI14Hui2ILGsfF1Uf2RnbNu9wT3
Linkedin:- https://www.linkedin.com/in/shubham-kashyap-65a29a218/
Instagram:- https://instagram.com/im_shubham_kashyap?igshid=YmMyMTA2M2Y=
My GFG Profile:- https://auth.geeksforgeeks.org/user/shubhamrajput6156/practice
#dsa #datastructures #algorithm #gfg #potd #coding #array #strings #tree #binarysearchtree #codekarlo #dynamicprogramming
To Make the array perfect you are allowed to do the following operation :
In one operation you can choose two different indexes i and j and set value of both arr[i] and arr[j] to arr[i]^arr[j].
Your task is to make the array perfect in minimum possible number of operations and return the number of operations.
Note: 0-based indexing is used.
0:00 Introduction
0:15 Problem Statement
1:18 White Board Explanation
4:38 Complexity Analysis
5:00 C++ Code
6:35 Java Code
gfg potd
gfg potd today
gfg problem of the day
My DSA Journey:- https://youtu.be/quZBBv12mCQ
How to Earn By GFG Articles:- https://youtu.be/XjvEgkd49Gk
Problem Link:-https://practice.geeksforgeeks.org/problems/ed0422e992899f3f46340ce97b0090683ceebd67/1
Code Link:-https://github.com/ShubhamKashyap138/Data-Structure/blob/main/Bit%20Magic
Playlist Link:-https://youtube.com/playlist?list=PLq3GlRZI14Hui2ILGsfF1Uf2RnbNu9wT3
Linkedin:- https://www.linkedin.com/in/shubham-kashyap-65a29a218/
Instagram:- https://instagram.com/im_shubham_kashyap?igshid=YmMyMTA2M2Y=
My GFG Profile:- https://auth.geeksforgeeks.org/user/shubhamrajput6156/practice
#dsa #datastructures #algorithm #gfg #potd #coding #array #strings #tree #binarysearchtree #codekarlo #dynamicprogramming
- Категория
- Язык программирования C++

Комментариев нет.