first short the jobs with respect to their profit
j2,j3,j5,j4=j1
And short jobs with respect to their deadline early job first
j2=j5,j3=j4,j1
initialize a variable profit=0, and a stack for holding done jobs.
step 1: Take max profit job with minimum deadline (means early job).
stack=j2
profit=100
step 2: Take next max profit job in remaning with minimum deadline (means early job).
stack=j2,j3
profit=100+50
step 3: Take next max profit job in remaining with minimum deadline (means early job).
stack=j2,j3,j1
profit=100+50+25
final profit is 175