Azzera filtri
Azzera filtri

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.

1 visualizzazione (ultimi 30 giorni)
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.

Risposta accettata

Dinesh Yadav
Dinesh Yadav il 29 Ott 2019
Hi, I am attaching a code file for the above question. Hope it helps.
  1 Commento
Abhishek Bakhla
Abhishek Bakhla il 29 Ott 2019
Modificato: Abhishek Bakhla il 29 Ott 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.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Multidimensional Arrays in Help Center e File Exchange

Prodotti


Release

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by