PROBLEM OF THE DAY : 02/01/2024 | Implement Atoi
source link: https://www.geeksforgeeks.org/videos/problem-of-the-day-02012024-implement-atoi/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
PROBLEM OF THE DAY : 02/01/2024
Welcome to the daily solving of our PROBLEM OF THE DAY with Yash Dwivedi We will discuss the entire problem step-by-step and work towards developing an optimized solution. This will not only help you brush up on your concepts of Strings but also build up problem-solving skills.
In this problem, we are given a string, s, the objective is to convert it into integer format without utilizing any built-in functions. If the conversion is not feasible, the function should return -1.
Note: Conversion is feasible only if all characters in the string are numeric or if its first character is '-' and rest are numeric.
Example :
Input:
s = "-123"
Output:
-123
Explanation:
It is possible to convert -123 into an integer
and is so returned in the form of an integer
Give the problem a try before going through the video. All the best!!!
Problem Link: https://www.geeksforgeeks.org/problems/implement-atoi/1
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK