We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
publicstaticList<int>permutationEquation(List<int>p){// Sort the list and keep track of the original indicesvarsortedListWithIndices=p.Select((value,index)=>new{Value=value,OriginalIndex=index+1}).OrderBy(x=>x.Value).ToList();// Create a list to store the transformed indicesvartempList1=sortedListWithIndices.Select(x=>x.OriginalIndex).ToList();// Create a list to store the final resultvartempList2=tempList1.Select(index=>p.IndexOf(index)+1).ToList();returntempList2;}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Sequence Equation
You are viewing a single comment's thread. Return to all comments →
here is my c# solution ,