As a newbie programmer
As a newbie programmer

As a newbie programmer

Sharing entry level codes. My snippets on GitHub https://github.com/locharp/code-snippets


String Matching @ Dcoder

10 Mar 2023 1 minute read 2 comments Lochard

Problem: Cody has a sequence of characters N. He likes a sequence if it contains his favourite sequence as a substring. Given the sequence and his favourite sequence F, check whether the favourite sequence is present in the sequence. Input: The first...

SwapMaster solves Symmetric Swap @ Dcoder

7 Mar 2023 1 minute read 0 comments Lochard

roblem: The SwapMaster is known to be the greatest and fastest swapper of all time. You intend to bring him down and become the new SwapMaster of the city. Through some secret sources, you found out that The SwapMaster undertook yet another task from...

Floating Number @ Dcoder

4 Mar 2023 1 minute read 2 comments Lochard

Problem: Bob has a floating point number N. He wants to set the precision for 2 digits after the decimal point for the number.He is not good at coding, hence looking for your help.Input: The first line contains T, the number of test cases.Next T line...

Rotate Array @ Dcoder

2 Mar 2023 1 minute read 0 comments Lochard

Problem: You are given an array of N length. You have to rotate the array rightwards by K rotations, that is, shift each element to the right by K positions. Print the rotated array. Input: First line contains N and K. Second line contains N integers...

Double the Number @ Dcoder

15 Feb 2023 1 minute read 0 comments Lochard

Problem: Given an array A of size N and K. count all the number of elements such that A[i] * 2 = K. Input: The first line of the input contains a single integer T denoting the number of test cases. The first line of each test case contains two space...

Bitwise for Dummies @ Dcoder

13 Feb 2023 1 minute read 0 comments Lochard

Problem: This is to provide you with an introductory experience of bit-wise operations. There are basically six bit-wise operations in any programming language : - AND(&), OR(|), XOR(^), NOT(~), left-shift operator(). You will be given 2 numbers a an...

Advent of Code 2022 Day 3

27 Jan 2023 1 minute read 0 comments Lochard

Sorry that I am blogging via my phone and I don't want to type too much. I will just share the finished code. You can see all of them on GitHub. --- Advent of Code 2022 Day 3 **Part 1** inputs

Advent of Code 2022 Day 2

25 Jan 2023 1 minute read 0 comments Lochard

Sorry that I am blogging via my phone and I don't want to type too much. I will just share the finished code. You can see all of them on [GitHub](https://github.com/locharp/code-snippets/tree/main/AdventOfCode). --- Advent of Code 2022 Day 2 **Part 1...

Advent of Code 2022 Day 1

24 Jan 2023 1 minute read 0 comments Lochard

Sorry that I am blogging via my phone and I don't want to type too much. I will just share the finished code. You can see all of them on GitHub. Advent of Code 2022 Day 1 **Part 1** inputs

C Kata - Are you playing banjo?

11 Jan 2023 1 minute read 0 comments Lochard

Learning from YayoDrayber, I am sharing my CodeWars DESCRIPTION:Create a function which answers the question "Are you playing banjo?".If your name starts with the letter "R" or lower case "r", you are playing banjo! The function takes a name as its o...