Problem 1 : https://leetcode.com/problems/minimum-swaps-to-group-all-1s-together/ - its more like dutch national flag algorithm
Problem 2 : https://leetcode.com/discuss/interview-question/1469039/Amazon-OA-CountMaximumTeams/1086834 -- sliding window will help to solve this
solved both but few test cases not passed..i dont think they will consider.