Programming

611 Articles 12 Followers


Codewars Kata - Testing 1-2-3

12 Aug 2023 1 minute read 0 comments Lochard

DESCRIPTION: Your team is writing a fancy new text editor and you've been tasked with implementing the line numbering.   Write a function which takes a list of strings and returns each line prepended by the correct number.   The numbering starts at 1...

Cody's Team @ Dcoder

10 Aug 2023 1 minute read 0 comments Lochard

Problem: Cody is preparing for a programming competition. He needs k more members for his team to be eligible for the competition. So he organizes a coding test for all his juniors to select the best group. His teacher has instructed him to only sele...

Arithmetic Sequence @ Dcoder

9 Aug 2023 1 minute read 0 comments Lochard

Problem: In mathematics, an arithmetic progression (AP) or arithmetic sequence is a sequence of numbers such that the difference between the consecutive terms is constant. John was writing an Arithmetic sequence with N terms, but while writing he mis...

Dcoder Admiration @ Dcoder

6 Aug 2023 1 minute read 0 comments Lochard

Problem: Dcoder has N members each numbered from 1 to N. A member admires other member if its number divides the other member's number.    Given a number N you need to find the number of people with odd number of admirers   Input: T the number of tes...

Leetcode - 139. Word Break

5 Aug 2023 1 minute read 0 comments Lochard

Given a string s and a dictionary of strings wordDict, return true if s can be segmented into a space-separated sequence of one or more dictionary words.   Note that the same word in the dictionary may be reused multiple times in the segmentation.  ...

Word Frequency @Dcoder

4 Aug 2023 1 minute read 0 comments Lochard

Title: Word Frequency Problem: You will be given a group of words. You need to print all unique words in that group in descending order of their frequency, i.e the word repeated most number of times will come first. In case of two words having the sa...

Simple multiple problem @ Dcoder

3 Aug 2023 1 minute read 0 comments Lochard

Problem: You are given 2 numbers N and M. You have to find the smallest number which when multiplied to N makes it a multiple of M.   Input: First line contains T, number of test cases. Each of the next T lines contains two numbers, N and M. Output:...

Leetcode - 1089. Duplicate Zeros

1 Aug 2023 1 minute read 1 comment Lochard

Given a fixed-length integer array arr, duplicate each occurrence of zero, shifting the remaining elements to the right.   Note that elements beyond the length of the original array are not written. Do the above modifications to the input array in pl...

Symmetric Matrix @ Dcoder

1 Aug 2023 1 minute read 0 comments Lochard

Problem: Given a matrix of dimensions N x N. Print "YES"(without quotes) if it is a symmetric matrix, else print "NO"(without quotes).   Input: First line contains N. Each of following N lines contains N integers each, denoting the matrix.   Output:...

Wrestling Championship @ Dcoder

31 Jul 2023 1 minute read 0 comments Lochard

Problem: Hulk is participating in a wrestling championship. The contest consists of N fighters including Hulk. The contest is of several stages. At each stage, if number of fighters are X, then there are X/2 fights and X/2 fighters move on to the nex...