【LeetCode程序员面试金典】面试题 01.02. Check Permutation LCCI

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

Example 1:

Input: s1 = "abc", s2 = "bca"
Output: true
Example 2:

Input: s1 = "abc", s2 = "bad"
Output: false
Note:

0 <= len(s1) <= 100
0 <= len(s2) <= 100

来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/check-permutation-lcci
著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。

java 同第一题  使用散列思想 

【LeetCode程序员面试金典】面试题 01.01. Is Unique LCCI

https://hanxu.blog.csdn.net/article/details/106053696

首先对 字符串进行预判 然后再进行 字符出现次数统计,判断数量。

class Solution {
    public boolean CheckPermutation(String s1, String s2) {
        if(s1.length() != s2.length()||s1.length()==0){
            return false;
        }
        int[] num = new int[300];
        for(int i=0;i

 

你可能感兴趣的:(程序员面试金典,LeetCode)