GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

Friday, 20 May 2022

[Solution] Make them Zero CodeChef Solution | CodeChef Problem Solution 2022

You are given an array A of length N.

You can perform the following operation on the array any number of times:

  • Choose any subsequence S of the array A and a positive integer X such that X is a power of 2 and subtract X from all the elements of the subsequence S.
Solution Click Below:-  CLICK HERE


Find the minimum number of operations required to make all the elements of the array equal to 0.

Input Format

  • First line will contain T, number of test cases. Then the test cases follow.
  • First line of each test case contains an integer N denoting the length of the array A.
  • Second line contains N space-separated integers A1,A2,,AN - denoting the elements of array A.

Output Format

For each test case, output in a single line, the minimum number of moves required to make all the elements of the array A equal to 0.

Constraints

  • 1T1000
  • 1N105
  • 0Ai109
  • Sum of N over all test cases do not exceed 2105.

No comments:

Post a Comment