Effacer les filtres
Effacer les filtres

Given an array A of n elements. We need to change the array into a permutation of numbers from 1 to n using minimum replacements in the array.

2 vues (au cours des 30 derniers jours)
Given an array A of n elements. We need to change the array into a permutation of numbers from 1 to n using minimum replacements in the array.

Réponse acceptée

Dinesh Yadav
Dinesh Yadav le 29 Oct 2019
Hi, I am attaching a code file for the above question. Hope it helps.
  1 commentaire
Abhishek Bakhla
Abhishek Bakhla le 29 Oct 2019
Modifié(e) : Abhishek Bakhla le 29 Oct 2019
Thanks for your help. It worked. I have also done similar to yours instead of while, i used find function for having indicies which are zeros and assigning the same in similar manner.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Multidimensional Arrays dans Help Center et File Exchange

Produits


Version

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by