India’s Best Job Seekers and Training Platform Forums Data Structure Given two (dictionary) words as Strings, determine if they are isomorphic…

  • Given two (dictionary) words as Strings, determine if they are isomorphic…

     Akash  updated 11 months, 2 weeks ago 1 Member · 1 Post
  • Akash 

    Administrator
    at

    Given two (dictionary) words as Strings, determine if they are isomorphic. Two words are called isomorphic
    if the letters in one word can be remapped to get the second word. Remapping a letter means replacing all
    occurrences of it with another letter while the ordering of the letters remains unchanged. No two letters
    may map to the same letter, but a letter may map to itself.
    Example:
    given “foo”, “app”; returns true
    we can map ‘f’ > ‘a’ and ‘o’ > ‘p’
    given “bar”, “foo”; returns false
    we can’t map both ‘a’ and ‘r’ to ‘o’
    given “turtle”, “tletur”; returns true
    we can map ‘t’ > ‘t’, ‘u’ > ‘l’, ‘r’ > ‘e’, ‘l’ > ‘u’, ‘e’ -‘r’
    given “ab”, “ca”; returns true
    we can map ‘a’ > ‘c’, ‘b’

Log in to reply.

Original Post
0 of 0 posts June 2018
Now
KodNest Training New Batch is starting on 19th October 2020. Attend one week free demo classes.Register Now

New Report

Close