Given a list of process with process id and memory requirement, these process are seprated into two lists foregroundProcess List and backhgroundProcess list . Ex : int[][] fg = {{1,3},{2,2},{3,3},{4,5}} , int[][] bg = {{1,6},{2,3},{3,4}}. Along with this, deviceMemory is given. Find the pairs of foreground and background process which use the memory of device optimally i.e., fg[i][1] + bg[i][1] <= deviceMemory.