Thread: Finding the pair matched to given sum

  1. #1
    Registered User
    Join Date
    Nov 2020
    Posts
    34

    Finding the pair matched to given sum

    Hi guys .
    I'm struggling to implement in C a function that gets as two inputs , one input is an integer array, second input is the given sum.
    the function returns the pairs of two element that its sum equal to the given sum.
    I don't have much experience in C , and I started to implement the function by myself.


    I've seen the solution here step by step :
    Most commonly asked programming interview question and Answer #GOOGLE - YouTube

    but I really didn't understand the logic of the explained code in the video, could anyone please explain to me the algorithm / the code that's explained on the video?
    how really we find the matched two pairs that its sum equal to the given sum?


    For me a pseudo code is also awesome to understand the solution of the problem.


    Much appreciated.
    Last edited by JohnnyOmari; 01-02-2021 at 01:01 PM.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    So are you here to get help with your programming assignment, or to spam 30 minute trash youtube videos?

    > I don't have much experience in C
    Compared to your other recent assignments, this seems quite easy.
    If you mooch off the good will of other people for too long, your programming career will be short. You NEED to do the work yourself, not just watch other people do it.

    > and I started to implement the function by myself.
    So post your best effort so far.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    I guess we all know who you are and what you are now 'RyanC'
    challenged problem C++ implementation - homework help (preparing for an interview).
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Vector pair
    By Ducky in forum C++ Programming
    Replies: 3
    Last Post: 12-13-2010, 01:50 PM
  2. How to store key value pair?
    By ketu1 in forum C++ Programming
    Replies: 12
    Last Post: 01-02-2008, 05:25 AM
  3. struct pair - Please Help!
    By LuckY in forum Windows Programming
    Replies: 2
    Last Post: 03-16-2003, 09:35 PM
  4. need another pair of eyes please
    By dustyd in forum C++ Programming
    Replies: 4
    Last Post: 01-23-2003, 03:12 PM
  5. need a second pair of eyes
    By Unregistered in forum C++ Programming
    Replies: 3
    Last Post: 06-27-2002, 12:36 PM

Tags for this Thread