practice-problems-1/comments/14-scramble-string.rb
# Write a method that takes in a string and an array of indices in the
# string. Produce a new string, which contains letters from the input
# string in the order specified by the indices of the array of indices.
#
# Difficulty: medium.
Write a method that takes in a string and an array of indices in the
string. Produce a new string, which contains letters from the input
string in the order specified by the indices of the array of indices.

medium.
Write a method that takes in a string and an array of indices in the string . Produce a new string which contains letters from the input string in the order specified by the indices of the array of indices . medium .
def scramble_string(string, positions)
  newString = ""                    
  for i in positions                
      newString += string[i]        
  end
return newString                    
end
def scramble_string ( string , positions ) newString = "" for i in positions newString += string [ i ] end return newString end
Write a method that takes in a string and an array of indices in the
string.
Write a method that takes in a string and an array of indices in the string .
#answer  #loop through positions. Remember: The positions are the new indexes for each letter from the orginal string #get the value based located at the index.  #return answer
string
<not_specific>
positions
<not_specific>