vinodhian
BAN USERLemme assume that there are 5 bus:
/* details[x][0] contains the arrival time and and details[x][1] contains the departure time of 5 buses where x = 0 to 4 */
/* starts with details[0][1] and ends in details[4][1] */
/* details[ ][ ] array can be populated in minutes as follows :
1.let us assume 24 hours clock.
2. 00:25 is equivalent to 0+25 mins.
3. similarly 10:45 will be 10*60 +45.
4. And 13:15 will be 13*60 + 45.
Note : Here am not considering the buses which arrive and leaves the next day or it stays more than a day. Yet to think a logic for it.
int MinimumPlatform( int details[5][2] )
{
int i,j,k=0,min =1;
for ( i = 0; i < 5; i ++)
{
k = 0;
for ( j =0; j < i ; j--)
{
if ( details[i][0] < details[j][1];
{
k++;
}
}
if ( k == i +1 )
{
min ++;
}
}
return min;
}
Heh guys kindly clarify my doubt in this question...
Question says that the product of substrings must be unique if the number has to be said colorful.
For a number "263", the subsets are { 2,6,3,26,23,63,263}. As the problem suggests should we find the product between substrings(i.e 26*23, 63*263......) or within the substring itself(i.e., 2*6,2*3,6*3,2*6*3) ?!
Is that array is a binary representation of the number? Or just split up of the digits as arrays..?
- vinodhian September 28, 2012