MUYANG GUO / INDEX

LeetCode

LintCode 211 String Permutation - Easy

211. String Permutation

·1 min read·#LintCode#Easy#Python

211. String Permutation — Easy

Open on LintCode

Problem

  1. String Permutation

Given two strings, write a method to decide if one is a permutation of the other.

Example Example 1: Input: "abcd", "bcad" Output: True

Example 2: Input: "aac", "abc" Output: False

Solution

class Solution:
    """
    @param A: a string
    @param B: a string
    @return: a boolean
    """
    def Permutation(self, A, B):
        # write your code here
        A = sorted(A)
        B = sorted(B)
        return A==B

Comments