Hi guys, it's been a long time since I visited this site in 2023. So, currently, I am a full-stack developer with 2 years of experience. Two days ago, I had a user interview with a 15 minutes live coding test for .NET Developer role. The test was to find if a word is a palindrome or not. So this is my code:
using System;
class HelloWorld {
static void Main() {
var word="input";
char[] lowerCaseWordArr= word.ToLower().ToCharArray();
var newString=new string (lowerCaseWordArr);
var reversedString="";
for(int i=newString.Length-1;i>=0;i--){
reversedString+=newString[i];
};
if(word.ToLower()==reversedString){
Console.Write("This is palindrome");
}else{
Console.Write("This is not palindrome");
}
}
}
How do you rate my code, and what should I improve?
Top comments (0)