Geeksforgeeks

Error

×

Leaderboard

Showing:

Handle | Score |
---|---|

@Ibrahim Nash | 6564 |

@blackshadows | 6400 |

@mb1973 | 5785 |

@Quandray | 5275 |

@akhayrutdinov | 5111 |

@saiujwal13083 | 5074 |

@kirtidee18 | 4639 |

@sanjay05 | 3762 |

@mantu_singh | 3712 |

@gfgaccount | 3627 |

@marius_valentin_dragoi | 3525 |

Complete Leaderboard | |

Handle | Score |

@yaswanthero123 | 625 |

@vikash619 | 611 |

@venkat11803610 | 501 |

@roshan13ar | 396 |

@DevangSingh | 379 |

@ravi11815721 | 312 |

@hrishipangavhane | 286 |

@aryanjain85297 | 280 |

@kommaraju11806903 | 277 |

@infosumitraut | 272 |

@ankitsharma5422 | 256 |

Complete Leaderboard |

Given an array **arr[]** of integers and an integer **sum**, the task is to count all subsets of the given array with a sum equal to a given **sum**.

Note: Answer can be very large, so, output answer modulo 10^{9}+7

**Example 1:**

Input: N = 6, arr[] = {2, 3, 5, 6, 8, 10} sum = 10Output:3Explanation: {2, 3, 5}, {2, 8}, {10}

Input: N = 5, arr[] = {1, 2, 3, 4, 5} sum = 10Output:3Explanation: {1, 2, 3, 4}, {1, 4, 5}, {2, 3, 5}

You don't need to read input or print anything. Complete the function

`perfectSum`

() 1 ≤

Login to report an issue on this page.

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

YesLoading...

Perfect Sum Problem

...