This is a copy paste question from Daily Bite email.

This question is asked by Google. Given a string, reverse all of its characters and return the resulting string.

Ex: Given the following strings…

“Cat”, return “taC”
“The Daily Byte”, return "etyB yliaD ehT”
“civic”, return “civic”

Solution using C#

using System;public class Test
{
public static void Main()
{
// your code goes here
string name = "Kapil";

System.Console.WriteLine(name);
int length = name.Length;
for(int i=length-1; i>=0; i--)
{
System.Console.Write(name[i]);
}
}
}

Disclaimer: Copied without permission from The Daily Bite email.

thedailybyte.dev

My self Kapil Patel a software engineer with 8 years of experience. I am trying to solve this with whatever knowledge I have, also I will be improving my solution as I find better solutions from fellow engineers!

How to put code in Medium post, how to format code

Simply press Ctrl + Alt + 6 and then start writing your code or paste your code.

In Mac use Ctrl alternative.

Must have for a back-end engineer

This is a partial list, I will keep updating it as I find

.NET background

C#
.Net Core
Web Api
Unit Test Framework (nUnit/xUnit)
SQL Server, CRUD operation
Cloud (Azure/Openshift/AWS/other cloud tech), if have hosting experience in one of these that’s fine
Microservices :- Good to have
Apache Kafka/Rabbit MQ or other message broker :- Good to have
DevOps (Azure DevOps/Jenkins/Bamboo/Octopus/any other CI/CD tools) and Unit-test integration in CI/CD pipeline :- Good to have

Write a program to reverse an array

Solution passes the test case but may not be most efficient

I will keep updating this with better solution.

Solution using C#.

using System;
public class Codemirror{

static void ReverseArray (int[] inputArr)
{
int arrayHalfLength = inputArr.Length/2;
for(int i = 0; i < arrayHalfLength ; i++)
{
int temp1 = inputArr[i];
int temp2 = inputArr[inputArr.Length-1-i];
//swap
inputArr[i] = temp2;
inputArr[inputArr.Length-1-i] = temp1;
}
PrintArray(inputArr);

}

static void PrintArray (int[] inputArr)
{
for(int i = 0; i < inputArr.Length; i++)
{
Console.Write(inputArr[i] + ", " );
}
Console.WriteLine();
}

static public void Main (){
//Code

//int[] arr = {11, 12, 5, 9, 16, 56, 8};
int[] arr = {5, 8, 2, 1};
PrintArray(arr);
ReverseArray(arr);
}
}

This post is another part of DSA RoadMap by The Code Skool

Youtube video:

https://www.youtube.com/watch?v=WjYdkHzcGhc&list=PL6ZXPAW2GSTuO4m6wCITtyVobnD1O1dkj

GeeksForGeeks top 50 array coding problems

https://www.geeksforgeeks.org/top-50-array-coding-problems-for-interviews/

Solution passes the test case but may not be most efficient

I will keep updating this with better solution.

Solution using C#.

using System;public class Codemirror{
static public void Main (){
//Code

int[] arr = {11, 12, 5, 9, 16, 56, 8};
int max = 0;
for(int i = 0; i < arr.Length; i++)
{
if(i==0)
{
max = arr[i];
}

if(max < arr[i] )
{
max = arr[i];
}
}
Console.WriteLine("Maximum element is: " + max);

}
}

This post is a first part of DSA RoadMap by The Code Skool

Youtube video:

https://www.youtube.com/watch?v=WjYdkHzcGhc&list=PL6ZXPAW2GSTuO4m6wCITtyVobnD1O1dkj

GeeksForGeeks top 50 array coding problems

https://www.geeksforgeeks.org/top-50-array-coding-problems-for-interviews/

Item 1 from above top 50 array problems

https://www.geeksforgeeks.org/check-if-a-key-is-present-in-every-segment-of-size-k-in-an-array/

Kapil Patel

Software engineer | loves working in a startup like environment

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store