<p>A binary watch has 4 LEDs on the top to represent the hours (0-11), and 6 LEDs on the bottom to represent&nbsp;the minutes (0-59). Each LED represents a zero or one, with the least significant bit on the right.</p>

<ul>
	<li>For example, the below binary watch reads <code>&quot;4:51&quot;</code>.</li>
</ul>

<p><img alt="" src="https://assets.leetcode.com/uploads/2021/04/08/binarywatch.jpg" style="width: 500px; height: 500px;" /></p>

<p>Given an integer <code>turnedOn</code> which represents the number of LEDs that are currently on (ignoring the PM), return <em>all possible times the watch could represent</em>. You may return the answer in <strong>any order</strong>.</p>

<p>The hour must not contain a leading zero.</p>

<ul>
	<li>For example, <code>&quot;01:00&quot;</code> is not valid. It should be <code>&quot;1:00&quot;</code>.</li>
</ul>

<p>The minute must&nbsp;consist of two digits and may contain a leading zero.</p>

<ul>
	<li>For example, <code>&quot;10:2&quot;</code> is not valid. It should be <code>&quot;10:02&quot;</code>.</li>
</ul>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<pre><strong>Input:</strong> turnedOn = 1
<strong>Output:</strong> ["0:01","0:02","0:04","0:08","0:16","0:32","1:00","2:00","4:00","8:00"]
</pre><p><strong class="example">Example 2:</strong></p>
<pre><strong>Input:</strong> turnedOn = 9
<strong>Output:</strong> []
</pre>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li><code>0 &lt;= turnedOn &lt;= 10</code></li>
</ul>

class Solution {
public:
    // 4 LEDS for hours
    vector<int>hours = {1,2,4,8};
    // 6 LEDS for minutes
    vector<int>mins = {1,2,4,8,16,32};
    // helper function : Ye 4 parameters lega :
    // a) result vector of strings
    // b) ek pair of hours and minutes jahan par time.first hour ko represent karega and time.second minutes ko
    // c) No_Of_LEDs : iska use hum kitne LEDs on karne reh gaye hai iske liye use karenge
    // d) idx : current position of pointer in vectors (hours and mins)
    void helper(vector<string>&res,pair<int,int>time,int No_Of_LEDs,int idx)
    {
        // agar number of LEDs zero hojaate hai iska matlab mujhe ek possible time milgaya jisse mein apne result vector mein add karlunga
        if(No_Of_LEDs==0)
        {
            // agar number of minutes less than 10 hai toh ":0" ko add karenge like this : "12:05"
            if(time.second<10)
            {
                res.push_back(to_string(time.first)+":0"+to_string(time.second));
            }
            // agar number of minutes greater than 10 hai toh ":" ko add karenge like this : "12:15"
            else
            {
                res.push_back(to_string(time.first)+":"+to_string(time.second));
            }
            return;
        }
        int n = hours.size();
        int m = mins.size();
        for(int i=idx;i<(m+n);i++)
        {
            // agar saare 6 LEDs hours waale check nahi kare abhi toh pehle unhe check karo
            if(i<n)
            {
                // current hour waale LED ko lelo
                time.first += hours[i];
                // agar hours less than 12 hai toh aage bado
                if(time.first<12)
                {
                    helper(res,time,No_Of_LEDs-1,i+1);
                }
                // backtracking step current hour jo liya tha usse remove karo taaki kisi aur hour waale LED ko use kar saken
                time.first -= hours[i];
            }
            // agar saare 6 LEDs hours waale check karliye toh ab minutes waale LEDs ko check karo
            else
            {
                // current minutes waale LED ko lelo
                time.second += mins[i-n];
                // agar minutes less than 60 hai toh aage bado
                if(time.second<60)
                {
                    helper(res,time,No_Of_LEDs-1,i+1);
                }
                // backtracking step current minutes jo liya tha usse remove karo taaki kisi aur minutes waale LED ko use kar saken
                time.second -= mins[i-n];
            }
        }
    }
    vector<string> readBinaryWatch(int turnedOn) {
        // ek vector of string le lenge return karne ke liye
        vector<string>res;
        // helper function ko call karenge
        helper(res,{0,0},turnedOn,0);
        return res;
    }
};
10100