- Output for git.master, git.master_jit, rfc.property-hooks
- <br>--------16---------<br>[12,3,1]<br>[3,4,9]<br>[1,6,9]<br>3<br>--------24---------<br>[12,3,9]<br>1<br>--------32---------<br>0 <div class="panel-body"> <h1>Count of all triplets with constant sum</h1> <p>Given an array of numbers, write an algorithm to find all the triplets of the numbers whose sum is a constant <strong>K</strong></p> <p>Implement the placeholder function (in the code editor) which takes an input integer array and returns the count of triplets</p> <h2>Below are a few examples:</h2> <p><strong>Example 2:</strong> For the array <strong>[12, 3, 4, 1, 6, 9]</strong> and K = <strong>16</strong>, there are three triplet [ 12, 3, 1 ], [3, 4, 9] and [1, 6, 9] that sums to 16. And, it returns the count as <strong>2</strong></p> <p><strong>Example 2:</strong> For the array <strong>[12, 3, 4, 1, 6, 9]</strong> and K = <strong>24</strong>, there is only one triplet [ 12, 3, 9 ] that sums to 24. And, it returns the count as <strong>1</strong></p> <h2>Note</h2> <ul> <li>Implement the placeholder function</li> <li>First input is an integer constant</li> <li>Second input is an integer array</li> <li>If you choose C or C++, you have the third integer input which is the length of input array</li> <li>And the function returns an integer (count)</li> <li>Total number of elements in the input array can range from 5 to 10000</li> <li>Value of input array elements can range from 0 to 50000</li> <li>Output count is <span class="caps">NOT</span> a distinct triplets count. There can be duplicate triplets.</li> </ul> </div>
This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.
Active branches
Archived branches
Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page
- 2020-03-21 RFC: Is_Literal - declined
- 2020-12-04 Enumerations - included in PHP 8.1
- 2018-06-15 Typed Properties v2 - implemented in PHP 7.4
- 2016-08-12 Object typehint - included in PHP 7.2
- 2016-08-14 Arrow functions - withdrawn
- 2016-05-29 array_change_keys() - withdrawn
- 2016-04-19 Lexical scope support for anonymous classes - suspended
- 2016-04-17 Functional Interfaces - declined
- 2016-03-16 Typed Properties - superseded in favor of Typed Properties 2.0
- 2015-08-27 Callable Prototypes - declined
- 2015-05-01 Short Closures - declined / withdrawn in favor of Arrow Functions
- 2015-02-18 Scalar type hints v5 - included in PHP 7
- 2015-02-14 Union Types - declined
- 2013-09-22 Anonymous classes - included in PHP 7