1.3 Given two strings, write a method to decide if one is a permutation of the other.
當然如果不考慮運作效率的話,也可以分别對兩個字元串進行排序,排序後的兩個字元串如果完全相等則傳回true,反之傳回false。代碼如下:
1.3 Given two strings, write a method to decide if one is a permutation of the other.
當然如果不考慮運作效率的話,也可以分别對兩個字元串進行排序,排序後的兩個字元串如果完全相等則傳回true,反之傳回false。代碼如下: