You are not logged in. Please login at to post your questions!


What's wrong in my solution

asked 05 Jun '18, 19:47

bk54's gravatar image

accept rate: 0%

you are taking the min wrong first you are making mn=ar[0] then checking
consider the array 3 2 5 6 your code will return min as 3 but actual min is 2 and also the way you are calculating the ans is wrong as max can change when you increment the other salaries as salaries can be equal so you need to sort the array and add max-min (max=ar[n-1],min=ar[0]) to all the elements from 0 to n-2 as ar[n-1] would be the max add max-min to ans while max!= min then print ans


answered 05 Jun '18, 22:05

ssp547's gravatar image

accept rate: 25%

toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:


question asked: 05 Jun '18, 19:47

question was seen: 117 times

last updated: 05 Jun '18, 22:05