Geeksforgeeks

Error

×

Leaderboard

Showing:

Handle | Score |
---|---|

@Ibrahim Nash | 6420 |

@blackshadows | 6380 |

@mb1973 | 5642 |

@Quandray | 5233 |

@akhayrutdinov | 5111 |

@saiujwal13083 | 4510 |

@sanjay05 | 3762 |

@kirtidee18 | 3673 |

@marius_valentin_dragoi | 3522 |

@sushant_a | 3459 |

@verma_ji | 3413 |

Complete Leaderboard | |

Handle | Score |

@sanskar94511 | 533 |

@akashverma4 | 291 |

@swastik8750 | 237 |

@nishunishuraj18 | 223 |

@nayan2709 | 211 |

@ajaybhardwaj1999 | 196 |

@surajmamgai | 193 |

@AnshikaPandey | 192 |

@gurshehzadsingh | 188 |

@shardul08 | 185 |

@Rajpra786 | 181 |

Complete Leaderboard |

Given a string s containing 0's and 1's. You have to return a smallest positive integer **C**, such that the binary string can be cut into **C** pieces and each piece should be of the **power of 5 ** with no leading zeros.

**Example 1:**

**Input:**
s = "101101101"**
Output: **3
**Explanation: **We can split the given string
into three “101”s, where 101 is
the binary representation of 5.

**Example 2:**

**Input:
**s = "00000"
**Output: **-1
**Explanation: **0 is not a power of 5.

**Your Task:**

Your task is to complete the function **cuts() **which take a single argument(string s) and return C. You need not take any input or print anything.

**Expected Time Complexity: **O(|s|*|s|*|s|).

**Expected Auxiliary Space: **O(|s|).

**Constraints:**

1<=s.length()<=50

**Note: **The string **s **is a binary string.

Login to report an issue on this page.

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes
Cutting Binary String

...