fork download
  1. a = [12, 56, 17, 34, 101, 45, 89, 22, 101, 52]
  2.  
  3. x = max(a)
  4. r = len(a) - 1
  5.  
  6. for l in range(r, -1, -1):
  7. if a[l] != x:
  8. a[r] = a[l]
  9. r -= 1
  10.  
  11. for i in range(r, -1, -1):
  12. a[i] = x
  13.  
  14. print(a)
Success #stdin #stdout 0.02s 9176KB
stdin
Standard input is empty
stdout
[101, 101, 12, 56, 17, 34, 45, 89, 22, 52]