menu
techminis

A naukri.com initiative

google-web-stories
Home

>

Programming News

>

Arrays: Fi...
source image

Prodevelopertutorial

1M

read

406

img
dot

Arrays: Find a triplet that sum to a given value

  • The problem is to find a triplet in an unsorted array that sums up to a given value.
  • Two approaches to solve this problem are using three loops/brute force approach and an optimized approach using hashing.
  • In the brute force approach, three nested for loops are used to check for triplets that sum up to the given value.
  • In the optimized approach, a set is used to check if the remaining part of the triplet exists in the set.

Read Full Article

like

24 Likes

For uninterrupted reading, download the app