[How-To][Solved]Swagger-Ui not working

Fix Swagger UI Not Working in Spring Boot When setting up Swagger UI in a Spring Boot project, you may encounter issues getting it to display properly. Here is a checklist to troubleshoot and fix Swagger UI: 1. Add SpringFox Dependency Include the SpringFox Swagger dependency in your pom.xml: <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-boot-starter</artifactId> <version>3.0.0</version> </dependency> 2. … Continue reading [How-To][Solved]Swagger-Ui not working

[Java] Rotate array left or right n times

package com.abstractProgrammer; import java.util.Arrays; import java.util.stream.IntStream; public class Main { public static int[] rotateLeft(int[] arr, int numberOfRotation) { int[] temp = new int[numberOfRotation]; int finalNumberOfRotation = numberOfRotation % arr.length; System.arraycopy(arr, 0, temp, 0, numberOfRotation); IntStream .range(numberOfRotation, arr.length) .forEach(i -> arr[i - finalNumberOfRotation] = arr[i]); System.arraycopy(temp, 0, arr, arr.length - numberOfRotation, numberOfRotation); return arr; } public … Continue reading [Java] Rotate array left or right n times

[.Net] [solved] System.ArgumentNullException: Value cannot be null. (Parameter ‘key’)

This exception literally made me go mad, The stack-trace was such a trash for this, that I had to go debugging line by line, anyway, for me and for anyone else I'm posting the solution, which might be the case also for you, I'm also posting the not so useful stacktrace at the end of … Continue reading [.Net] [solved] System.ArgumentNullException: Value cannot be null. (Parameter ‘key’)

[TCS NQT][2021] Find area of circle and print it up to 2 decimals.

both the coding questions of TCS NQT were very easy this time, This is one of them, hidden in the story of Jack who needs to find out the area of his circular ground, and he knows the radius( good for us 😬 ) the only condition is - radius 'r' must satisfy the condition … Continue reading [TCS NQT][2021] Find area of circle and print it up to 2 decimals.

[TCS NQT][2021] Mirror characters of a string

this is another one, wrapped in another story that someone is building a cryptographic program and they need to convert 'a' to 'z' , 'b' to 'x' and so on, Also known as mirror characters - Python - 1st approach chars = [chr(i) for i in range(97, 123)] reversed_char = [chr(i) for i in reversed(range(97, … Continue reading [TCS NQT][2021] Mirror characters of a string

Replace every letter with its adjacent letter and convert all vowels to uppercase.

C++ #include<iostream> using namespace std; bool isAlphabet(char c) { if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) return true; return false; } bool isVowel(char c) { char vowels[] = {'a', 'e', 'i', 'o', 'u'}; for (char vowel : vowels) { if (vowel == c) { return true; … Continue reading Replace every letter with its adjacent letter and convert all vowels to uppercase.

Replace Words in a file and print count

JAVA import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; public class ReplaceWords { public static long countWords(String source, String wordToCount) { String[] words = source.split(" "); int count = 0; for (String word : words) { if (word.equals(wordToCount)) count++; } return count; } public static long replaceWords(String filePath , String[] wordsToReplace , String[] wordsToReplaceWith) throws … Continue reading Replace Words in a file and print count

[C#]Convert List/Enumerable to DataTable

public static DataTable ToDataTable<T>(this IEnumerable<T> iEnumerable) { if(iEnumerable is null) throw new ArgumentNullException(nameof(iEnumerable), "Enumerable is null"); var dataTable = new DataTable(); var propertyDescriptorCollection = TypeDescriptor.GetProperties(typeof(T)); foreach (PropertyDescriptor propertyDescriptor in propertyDescriptorCollection) { var type = propertyDescriptor.PropertyType; if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>)) type = Nullable.GetUnderlyingType(type); dataTable.Columns.Add(propertyDescriptor.DisplayName, type!); } var values = new object[propertyDescriptorCollection.Count]; foreach (var iListItem … Continue reading [C#]Convert List/Enumerable to DataTable

[Kotlin] Check if string is anagram

fun isAnagramSumCheck(string1: String, string2: String): Boolean { val cleanedString1 = cleanString(string1) val cleanedString2 = cleanString(string2) return if (cleanedString1.length != cleanedString2.length) false; else { cleanedString1.toLowerCase().sumBy { it.toInt() } == cleanedString2.toLowerCase().sumBy { it.toInt() } } } fun cleanString(string: String): String { return string.replace( Regex("[^a-zA-Z]"), "") } fun isAnagramCharCheck(string1: String, string2: String): Boolean { val cleanedString1 = cleanString(string1) … Continue reading [Kotlin] Check if string is anagram