Checking whether two numbers are permutation of each other?

前端 未结 7 2053
借酒劲吻你
借酒劲吻你 2021-02-15 22:44

Given two numbers a, b such that 1 <= a , b <= 10000000000 (10^10). My problem is to check whether the digits in them are permutation of each other or not. What is the fas

7条回答
  •  我寻月下人不归
    2021-02-15 23:26

    Well if you can build an 80GB table, you could always do:

    int64 table[10000000000] = {0, blah blah..., 9999999999};
    
    if (table[a] == table[b]) ...
    

提交回复
热议问题