Добавить
Уведомления

Game Of Subsets | GFG | POTD | 25th April 2023 | DP | Masking | Java | C++ | Problem Of The Day

The video solves Problem Of The Day question " Game Of Subsets " asked on GeeksForGeeks on 25th April 2023 . The approach used in the provided code is dynamic programming. The goal is to count the number of good subsets in an array, where a subset is considered good if it does not contain two numbers that share a prime factor. The algorithm first precomputes an array of masks representing whether each number from 2 to 30 is divisible by any of the first 10 prime numbers. Then, it uses dynamic programming to compute the number of good subsets for each possible subset mask. Finally, it computes the total number of good subsets by summing the counts in the dynamic programming array, and multiplies by 2 raised to the power of the count of ones in the input array, if there are any. GFG POTD 25th April 2023 : https://practice.geeksforgeeks.org/problems/cec5db442a5652d07dd41e37ea780345f08c9a3d/1 Java | C++ solution Code Link : https://docs.google.com/document/d/1of9_idPiHg-ZCH9bLcwsyS2Jtb4tfXzrbWk9wFcAjtQ/edit?usp=sharing Java Interview Series : https://youtube.com/playlist?list=PLepRefP5xf4iAkuz_Nh71SG7s6h3JA0jH GFG POTD series : https://www.youtube.com/watch?v=MJtTx67TO3E&list=PLepRefP5xf4h5LTPRsU59rduUWR1nEqtm Java -17 series : https://www.youtube.com/watch?v=VHe6wDCEna0&list=PLepRefP5xf4h7d4-hn1ko8hxT6NVwT8z2

Иконка канала Кодерская академия
12 подписчиков
12+
15 просмотров
2 года назад
5 декабря 2023 г.
12+
15 просмотров
2 года назад
5 декабря 2023 г.

The video solves Problem Of The Day question " Game Of Subsets " asked on GeeksForGeeks on 25th April 2023 . The approach used in the provided code is dynamic programming. The goal is to count the number of good subsets in an array, where a subset is considered good if it does not contain two numbers that share a prime factor. The algorithm first precomputes an array of masks representing whether each number from 2 to 30 is divisible by any of the first 10 prime numbers. Then, it uses dynamic programming to compute the number of good subsets for each possible subset mask. Finally, it computes the total number of good subsets by summing the counts in the dynamic programming array, and multiplies by 2 raised to the power of the count of ones in the input array, if there are any. GFG POTD 25th April 2023 : https://practice.geeksforgeeks.org/problems/cec5db442a5652d07dd41e37ea780345f08c9a3d/1 Java | C++ solution Code Link : https://docs.google.com/document/d/1of9_idPiHg-ZCH9bLcwsyS2Jtb4tfXzrbWk9wFcAjtQ/edit?usp=sharing Java Interview Series : https://youtube.com/playlist?list=PLepRefP5xf4iAkuz_Nh71SG7s6h3JA0jH GFG POTD series : https://www.youtube.com/watch?v=MJtTx67TO3E&list=PLepRefP5xf4h5LTPRsU59rduUWR1nEqtm Java -17 series : https://www.youtube.com/watch?v=VHe6wDCEna0&list=PLepRefP5xf4h7d4-hn1ko8hxT6NVwT8z2

, чтобы оставлять комментарии