We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Beautiful Triplets
Beautiful Triplets
Sort by
recency
|
1070 Discussions
|
Please Login in order to post a comment
Here is my O(n) c++ solution, you can watch the implementation here : https://youtu.be/vLD3N79nLSE
i learned this elegant solution from a similar problem "count triplets", where it is a geometric series ak = aj *d, aj = ai *d:
func beautifulTriplets(d int32, arr []int32) int32 {
}
My PHP solution:
This is the simple approach in the python language