Max Difference between two elements in Swift

Publié le: 23 octobre 2018
sur la chaîne: Ilyas Uyanik
139
0

Given an array arr[] of integers, find out the maximum difference between any two elements such that larger element appears after the smaller number.
Examples :

Input : arr = {2, 3, 10, 6, 4, 8, 1}
Output : 8
Explanation : The maximum difference is between 10 and 2.

Input : arr = {7, 9, 5, 6, 3, 2}
Output : 2
Explanation : The maximum difference is between 9 and 7.

Reference : https://www.geeksforgeeks.org/maximum...


Sur cette page du site, vous pouvez voir la vidéo en ligne Max Difference between two elements in Swift durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Ilyas Uyanik 23 octobre 2018, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 139 fois et il a aimé 0 téléspectateurs. Bon visionnage!