Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
I had this question once, although they didn't specify a language to use and didn't say no builtins, so... I used python.
return string[::-1]
This was for a Cloud DevOps job... Entry level, but still... -
phoxis2856yI don't think it's anything to do with the job, but problem solving and reversing a string is a pretty basic problem.
-
@SanitizedOutput you can't do something like this
new StringBuffer("your string").reverse().toString(); -
@SanitizedOutput that is exactly what I was thinking. How to I convert this string to an array of chars without any methods
-
I ask this question too in interviews. For a couple of reasons: when someone applies for a senior C# position I expect to know the framework's built in reverse method. If he doesn't know that, then I expect him to know that, when concatenating strings, you should use a stringbuilder when you do more than 5 concats, and if the applicant says to have experience in TDD, I expect to see it developed using TDD. In addition, this is quite a basic task, and you don't need strong mathematical skills to create a proper algorithm, I prefer such a simple assignment over some simple assignment that requires a solid mathematical background, unless of course you apply for a job as 3D engine developer where you'd need math.
Though the simple assignment you'd be surprised of all the different solutions people come up with! It gives a great opportunity for discussing why someone did it like that and gain some insights in someones way of thinking.
Related Rants
Reverse the given string without using inbuilt java methods... ðŸ˜ðŸ˜ðŸ˜ðŸ˜
Every time you will get this question even when you have more than 6 yrs of experience 😡
rant
java
wk135
string reversal
string