> For the complete documentation index, see [llms.txt](https://junnie.gitbook.io/amazon-mock-interview/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://junnie.gitbook.io/amazon-mock-interview/2022/oa/maxoperationofstring.md).

# maxOperationOfString

给两个字符串s和t，求问使用s所有的字母最多能够重组出几个t。举个栗子：s=“mononom”，t=“mon”，则答案是2。我用的是python，思路是用两个counter统计s和t的字母出现频率，然后遍历t的所‍‍‌‌‌‌‍‍‌‍‌‍‌‍‌‍‌‌‌‍有字母，找到s中出现次数/t中出现次数的最小值（向下取整） 运气很好，题目都很简单，

![](https://1589944109-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M33ghpGB0tSXSGhMSB5%2Fuploads%2FJjAKRBh5DtwRknzuzSKM%2Fimage.png?alt=media\&token=f9fd0842-5871-4a14-8133-282bf98b5f99)

![](https://1589944109-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M33ghpGB0tSXSGhMSB5%2Fuploads%2FJLkh6i8oeGnfcd0q8E3g%2Fimage.png?alt=media\&token=92f322e9-6e79-4537-b3bc-d81dd9365a8c)
