This question was asked in Facebook interview, Ask is to provide Running Total for Different Genders. Source: LeetCode Difficulty: Medium…