[Leetcode] Find anagram Mappings looking for heterogeneous mappings

Source: Internet
Author: User

Given lists A B and, and is a anagram of. is an B anagram of means are made by A B A B Rand Omizing the order of the elements in A .

We want to find a index mapping P , from A to B . A mapping P[i] = j means the i th element in A appears with at B index j .

These lists and may A B contain duplicates. If There is multiple answers, output any of them.

For example, given

A = [50, 12, 32, 46, 28], 50]b = [+]

We should return

[1, 4, 3, 2, 0]

P[0] = 1 0 as because the th element A of appears B[1] at, and P[1] = 4 because the 1 st element of A appears at c9/>, and so on.

Note:

    1. A, Bhas equal lengths in range [1, 100] .
    2. A[i], B[i]is integers in range [0, 10^5] .

S

[Leetcode] Find anagram Mappings looking for heterogeneous mappings

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.