Skip to content

O(n) algorithm for checking if one string is isometric to another

Notifications You must be signed in to change notification settings

KillzoneKid/isometric-strings

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

Isometric Strings

  • Given two strings s and t, determine if s is isomorphic to t.
  • String s is isomorphic to t if the letters in s can be remapped to get t.
  • Remapping a letter means replacing all occurrences of it in s with another letter.
  • A letter in s could only be mapped to one letter in t.
  • The ordering of the letters must remain unchanged.
For example:
  • Given "egg", "add", return true.
  • Given "foo", "bar", return false.
  • Given "paper", "title", return true.
Note:

You may assume both s and t are lower case and have the same length.

Solution:

This is an O(n) algorithm or better.

About

O(n) algorithm for checking if one string is isometric to another

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages