Submitted by: Mohammad Sajid Anwar
You are given a string containing only lower case English letters and digits.
Write a script to remove all digits by removing the first digit and the closest non-digit character to its left.
You are given a string containing only lower case English letters and digits.
Write a script to remove all digits by removing the first digit and the closest non-digit character to its left.
You are given a string containing only lower case English letters and digits.
Write a script to replace every non-digit character with a space and then return all the distinct integers left.
You are given a string containing only lower case English letters and ?
.
Write a script to replace all ?
in the given string so that the string doesn't contain consecutive repeating characters.
You are given an array of n
integers.
Write a script to find all the missing integers in the range 1..n
in the given array.
Recently, I came across a blog post titled, Slice of Perl by Dave Cross
. It's a must-read for Perl
programmers, as it highlights a useful feature that can simplify your life.
Reading it, reminded me of a subtle but important distinction I encountered years ago: the difference between lists
and arrays
in Perl
. I'm sharing my insights here in the hope that others will find then helpful.
Before diving into List Slicing
or Array Slicing
, it's essential to understand the difference between List
and Array
in Perl
.
When I first started learning Perl
(around 1998
), I only knew about arrays
and assumed every list was an array
.
However, lists
and arrays
while related, are distinct concepts.
You are given a date in the format YYYY-MM-DD
.
Write a script to find day number of the year that the given date represent.
You are given a binary array containing only 0
or/and 1
.
Write a script to find out the maximum consecutive 1
in the given array.
You are given an array of integers and two integers $r
amd $c
.
Write a script to create two dimension array having $r
rows and $c
columns using the given array.
You are given a list of operations.
Write a script to return the final value after performing the given operations in order. The initial value is always 0.