Python Forum
Solution to this task
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Solution to this task
#1
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()
Reply


Messages In This Thread
Solution to this task - by BASHIRA2 - Nov-15-2019, 09:50 PM
RE: Solution to this task - by ichabod801 - Nov-15-2019, 11:45 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020