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

Learning Strings and binary numbers @ Dcoder

Problem: Given two binary strings, A (of length 10) and B (of length 5), output 1 if B is a substring of A and 0 otherwise. Input: Binary string A and B separated by a space. Output: The logical value of: 'B is a substring of A'.  ie. 1 if B is subst...

Lochard 1 minute read 17 Jul 2023 0 comments $0.00

Dcooooooooooder Fan @ Dcoder

Problem: Print the word Dco...oder Input: A positive integer n Output: Print the word: Dco..oder(letter o must be repeted n times) Constraints: 0

Lochard 1 minute read 17 Jul 2023 0 comments $0.00

The light Switch @ Dcoder

Problem: There is a light bulb on the stairs, which has two switches. The light turns on if and only if one of them is on(binary 1) and other is off(binary 0).You are given combinations of these switch find whether the bulb glow or not? Input: Two bi...

Lochard 1 minute read 16 Jul 2023 0 comments $0.02

Learn Sum of numbers @ Dcoder

Problem: Given 2 natural numbers, find sum of them. Input: Two natural numbers n1 and n2 separated by a space. Output: Sum of the numbers Constraints: 1

Lochard 1 minute read 15 Jul 2023 0 comments $0.00

Sum of squares @ Dcoder

Problem: Compute the sum of squares for the given numbers: a, a+1, ..., b-1, b. Input: Two natural numbers a and b separated by a space. Output: Computed sum: a*a + (a+1)*(a+1) + ... + (b-1)*(b-1) + b*b Constraints: 1

Lochard 1 minute read 14 Jul 2023 0 comments $0.00

The Triangle Game @ Dcoder

Problem: Glin was doing his maths homework , Rick came to his house. As Glin is week at Maths, Rick decided to help him in his homework. They both stuck at a problem of Right Angle Triangle. You have to help them both in this problem. Input is a Stri...

Lochard 1 minute read 13 Jul 2023 2 comments $0.01

CodeWars C Kata - Double Char

DESCRIPTION: Given a string, you have to return a string in which each character (case-sensitive) is repeated once.   Examples (Input -> Output): * "String" -> "SSttrriinngg" * "Hello World" -> "HHeelllloo WWoorrlldd" * "1234!_ " -> "11223344!!__ " c...

Lochard 1 minute read 12 Jul 2023 0 comments $0.07

The sum of Array @ Dcoder

Problem: Given the array of N numbers, you have to find its sum. Input: The first line contains an integer N, number of elements in array.Next line contains N integers separated by space. Output: Print the sum of the array's elements. Constraints: 1

Lochard 1 minute read 11 Jul 2023 0 comments $0.00

The War of Problem Setters @ Dcoder

Problem: Garry and Sharry are colleague, assuming they work at Dcoder. They are our Problem Setters.One day we decide to judge their work. Both were given an assignment to make some problems to display at Dcoder, and they were awarded points based on...

Lochard 1 minute read 10 Jul 2023 0 comments $0.01

Avik and his Girlfriend's Necklace @ Dcoder

Problem: Avik's Girlfriend is a Sorted Girl and she is also a Coder and loves arrays. So on her birthday Avik decided to gift her a necklace of pearls, now these pearls have numbers printed on them. When he bought the necklace its pearls were in sort...

Lochard 1 minute read 9 Jul 2023 0 comments $0.01