Nov-15-2019, 09:50 PM
(This post was last modified: Nov-15-2019, 11:43 PM by ichabod801.)
Write a function that takes an array of integers and returns the number of triplets in the array.
class Solution: def find_triplets(self, input): If ( from solution import Solution import unittest class SolutionTests(unittest.TestCase): def test1(self): solution = Solution() self.assertEqual(solution.find_triplets([ 5, 5, 5, 5, 5, 5 ]), 2) def test2(self): solution = Solution() self.assertEqual(solution.find_triplets([ 4, 3, 3, 3, 6, 1, 1, 1 ]), 2) if __name__ == '__main__': unittest.main()