₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,823 members, 8,423,852 topics. Date: Wednesday, 10 June 2026 at 11:09 AM

Toggle theme

Fr4nk's Posts

Nairaland ForumFr4nk's ProfileFr4nk's Posts

1 2 3 (of 3 pages)

ProgrammingRe: Codewars.com Coding Challenges by Fr4nk(op): 10:30am On May 20, 2022
excanny:
You have to loop through the 2D array. You have to check that the rows and columns don’t contain duplicate values. A hashset can do that job. You also check that the values are within 0-9. Finally you check that the 3 x 3 matrices don’t contain duplicates.
Yeah on point, the hardest part for me was validating each of the 9 3x3 regions,
Here's what I did tho
I found a way to convert the 3x3 region into a 1D array and validate it just like you did for the rows and columns
ProgrammingRe: Codewars.com Coding Challenges by Fr4nk(op): 8:53am On May 20, 2022
excanny:
You mind if we have a group with like minds. So we can always solve the challenges. Need people who are consistent and passionate for competitive programming
Yes sir, that would be great
ProgrammingRe: Codewars.com Coding Challenges by Fr4nk(op): 8:49am On May 20, 2022
Altairx440:
It's ok, I just have to click "Quote" to get the full code. BTW what editor/IDE is this?
The one in the picture is just a text editor for android with syntax highlighting (it doesn't run code)
I'm actually using a web based editor called onecompiler.com I write all my codes and test them there, because I don't have a laptop now so I'm using my Android Tablet
ProgrammingRe: Codewars.com Coding Challenges by Fr4nk(op): 11:27pm On May 19, 2022
I noticed that a line was too long to be viewed here,
So I'm. Sending a screenshot too

ProgrammingRe: Codewars.com Coding Challenges by Fr4nk(op): 11:22pm On May 19, 2022
Fr4nk:
Done, here's my solution in python


import json

s1 = "Country\tState\tTown\r\nNigeria\tLagos State\tLagos\r\nUSA\tTexas\tDallas\r\n"
s2 = "Country\r\nUSA\r\nChina"
s3 = "Name\tAge\r\n"

def hashify(s):
data_extract = [x.split("\t"wink for x in s.split("\r\n"wink]
keys = data_extract[0]
key_num = len(keys)
values = data_extract[1:]

if [''] in values:
values.pop(values.index(['']))

return [json.loads("{" + ", ".join(x) + "}"wink for x in [[f'"{keys[k]}":"{d[k]}"' for k in range(key_num)] for d in values]]


print(hashify(s1))
print(hashify(s2))
print(hashify(s3))
replace all wink with ')'
Sorry for not adding comments smiley
ProgrammingRe: Codewars.com Coding Challenges by Fr4nk(op): 11:20pm On May 19, 2022
Altairx440:
You're given s, a string with an arbitrary number of headers and rows in the formats below;

s1 = "Country\tState\tTown\r\nNigeria\tLagos
State\tLagos\r\nUSA\tTexas\tDallas\r\n"
s2 = "Country\r\nUSA\r\nChina;
s3 = "Name\tAge\r\n"

return an array of objects in the format below;
# s1
[
{
'Country': 'Nigeria',
'State': 'Lagos State',
'Town': 'Lagos'
},
{
'Country': 'USA',
'State': 'Texas',
'Town': 'Dallas'
}
]
# s2
[
{
'Country': USA'
},
{
'Country': 'China'
}
]
# s3
[]
Done, here's my solution in python


import json

s1 = "Country\tState\tTown\r\nNigeria\tLagos State\tLagos\r\nUSA\tTexas\tDallas\r\n"
s2 = "Country\r\nUSA\r\nChina"
s3 = "Name\tAge\r\n"

def hashify(s):
data_extract = [x.split("\t"wink for x in s.split("\r\n"wink]
keys = data_extract[0]
key_num = len(keys)
values = data_extract[1:]

if [''] in values:
values.pop(values.index(['']))

return [json.loads("{" + ", ".join(x) + "}"wink for x in [[f'"{keys[k]}":"{d[k]}"' for k in range(key_num)] for d in values]]


print(hashify(s1))
print(hashify(s2))
print(hashify(s3))
ProgrammingRe: Codewars.com Coding Challenges by Fr4nk(op): 8:17pm On May 19, 2022
Fr4nk:
https://www.codewars.com/kata/53db96041f1a7d32dc0004d2

Write a function done_or_not/DoneOrNot passing a board (list[list_lines]) as parameter. If the board is valid return 'Finished!', otherwise return 'Try again!'

Sudoku rules:

Complete the Sudoku puzzle so that each and every row, column, and region contains the numbers one through nine only once.

Rows:


There are 9 rows in a traditional Sudoku puzzle. Every row must contain the numbers 1, 2, 3, 4, 5, 6, 7, 8, and 9. There may not be any duplicate numbers in any row. In other words, there can not be any rows that are identical.

In the illustration the numbers 5, 3, 1, and 2 are the "givens". They can not be changed. The remaining numbers in black are the numbers that you fill in to complete the row.

Columns:


There are 9 columns in a traditional Sudoku puzzle. Like the Sudoku rule for rows, every column must also contain the numbers 1, 2, 3, 4, 5, 6, 7, 8, and 9. Again, there may not be any duplicate numbers in any column. Each column will be unique as a result.

In the illustration the numbers 7, 2, and 6 are the "givens". They can not be changed. You fill in the remaining numbers as shown in black to complete the column.

Regions


A region is a 3x3 box like the one shown to the left. There are 9 regions in a traditional Sudoku puzzle.

Like the Sudoku requirements for rows and columns, every region must also contain the numbers 1, 2, 3, 4, 5, 6, 7, 8, and 9. Duplicate numbers are not permitted in any region. Each region will differ from the other regions.

In the illustration the numbers 1, 2, and 8 are the "givens". They can not be changed. Fill in the remaining numbers as shown in black to complete the region.

Valid board example:


For those who don't know the game, here are some information about rules and how to play Sudoku: http://en.wikipedia.org/wiki/Sudoku and http://www.sudokuessentials.com/
The easy part was that I'm not new to sudoku and I solve a good number of puzzles for fun or pass time, I even remember building a sudoku solver using recursion and backtracking techniques (it was long ago, maybe i'll try it again but without the tutorial lol)
ProgrammingRe: Codewars.com Coding Challenges by Fr4nk(op): 8:14pm On May 19, 2022
excanny:
Can you share the problem?
https://www.codewars.com/kata/53db96041f1a7d32dc0004d2

Write a function done_or_not/DoneOrNot passing a board (list[list_lines]) as parameter. If the board is valid return 'Finished!', otherwise return 'Try again!'

Sudoku rules:

Complete the Sudoku puzzle so that each and every row, column, and region contains the numbers one through nine only once.

Rows:


There are 9 rows in a traditional Sudoku puzzle. Every row must contain the numbers 1, 2, 3, 4, 5, 6, 7, 8, and 9. There may not be any duplicate numbers in any row. In other words, there can not be any rows that are identical.

In the illustration the numbers 5, 3, 1, and 2 are the "givens". They can not be changed. The remaining numbers in black are the numbers that you fill in to complete the row.

Columns:


There are 9 columns in a traditional Sudoku puzzle. Like the Sudoku rule for rows, every column must also contain the numbers 1, 2, 3, 4, 5, 6, 7, 8, and 9. Again, there may not be any duplicate numbers in any column. Each column will be unique as a result.

In the illustration the numbers 7, 2, and 6 are the "givens". They can not be changed. You fill in the remaining numbers as shown in black to complete the column.

Regions


A region is a 3x3 box like the one shown to the left. There are 9 regions in a traditional Sudoku puzzle.

Like the Sudoku requirements for rows and columns, every region must also contain the numbers 1, 2, 3, 4, 5, 6, 7, 8, and 9. Duplicate numbers are not permitted in any region. Each region will differ from the other regions.

In the illustration the numbers 1, 2, and 8 are the "givens". They can not be changed. Fill in the remaining numbers as shown in black to complete the region.

Valid board example:


For those who don't know the game, here are some information about rules and how to play Sudoku: http://en.wikipedia.org/wiki/Sudoku and http://www.sudokuessentials.com/
ProgrammingRe: Codewars.com Coding Challenges by Fr4nk(op): 7:45pm On May 19, 2022
excanny:
Got it working in C#
Nice
I haven't started doing it yet, I was busy with a tough codewars kata (write a function to check if a sudoku solution is valid or not)
I'll start now
ProgrammingRe: Codewars.com Coding Challenges by Fr4nk(op): 7:43pm On May 19, 2022
Altairx440:
Yeah, also seems like you did not learn JavaScript, is Python the only language you know?
Yes sir, python only, I may learn other languages like Javascript(soon because I want to work with flask or Django), R, C++ or Java or C# later, but being a python expert is d main goal
ProgrammingRe: Codewars.com Coding Challenges by Fr4nk(op): 2:03pm On May 19, 2022
Altairx440:
Of course, JavaScript was my first language lol, plus it's mostly called "object" or "map/hashmap" in other languages.
Yeah dictionaries / objects are Hashmaps,
Any language is allowed sir
ProgrammingRe: Codewars.com Coding Challenges by Fr4nk(op): 12:55am On May 19, 2022
Okay cool,
Your calling them objects, aren't they dictionaries lol
You sound like someone coming from JavaScript grin
ProgrammingRe: Codewars.com Coding Challenges by Fr4nk(op): 6:47pm On May 18, 2022
Altairx440:
You're given s, a string with an arbitrary number of headers and rows in the formats below;

s1 = "Country\tState\tTown\r\nNigeria\tLagos
State\tLagos\r\nUSA\tTexas\tDallas\r\n"
s2 = "Country\r\nUSA\r\nChina;
s3 = "Name\tAge\r\n"

return an array of objects in the format below;
# s1
[
{
'Country': 'Nigeria',
'State': 'Lagos State',
'Town': 'Lagos'
},
{
'Country': 'USA',
'State': 'Texas',
'Town': 'Dallas'
}
]
# s2
[
{
'Country': USA'
},
{
'Country': 'China'
}
]
# s3
[]
Why is s3 an empty list?
ProgrammingRe: Codewars.com Coding Challenges by Fr4nk(op): 2:13pm On May 18, 2022
Here's my solution

ProgrammingRe: Codewars.com Coding Challenges by Fr4nk(op): 2:13pm On May 18, 2022
Second one worked well too
ProgrammingRe: Codewars.com Coding Challenges by Fr4nk(op): 2:10pm On May 18, 2022
The first one worked well
ProgrammingRe: Codewars.com Coding Challenges by Fr4nk(op): 2:08pm On May 18, 2022
These are way too complex bro,
I'll test them out
ProgrammingRe: Codewars.com Coding Challenges by Fr4nk(op): 8:33pm On May 17, 2022
You are given an integer, . Your task is to print an alphabet rangoli of size . (Rangoli is a form of Indian folk art based on creation of patterns.)

Different sizes of alphabet rangoli are shown below:

#size 3

----c----
--c-b-c--
c-b-a-b-c
--c-b-c--
----c----

#size 5

--------e--------
------e-d-e------
----e-d-c-d-e----
--e-d-c-b-c-d-e--
e-d-c-b-a-b-c-d-e
--e-d-c-b-c-d-e--
----e-d-c-d-e----
------e-d-e------
--------e--------

#size 10

------------------j------------------
----------------j-i-j----------------
--------------j-i-h-i-j--------------
------------j-i-h-g-h-i-j------------
----------j-i-h-g-f-g-h-i-j----------
--------j-i-h-g-f-e-f-g-h-i-j--------
------j-i-h-g-f-e-d-e-f-g-h-i-j------
----j-i-h-g-f-e-d-c-d-e-f-g-h-i-j----
--j-i-h-g-f-e-d-c-b-c-d-e-f-g-h-i-j--
j-i-h-g-f-e-d-c-b-a-b-c-d-e-f-g-h-i-j
--j-i-h-g-f-e-d-c-b-c-d-e-f-g-h-i-j--
----j-i-h-g-f-e-d-c-d-e-f-g-h-i-j----
------j-i-h-g-f-e-d-e-f-g-h-i-j------
--------j-i-h-g-f-e-f-g-h-i-j--------
----------j-i-h-g-f-g-h-i-j----------
------------j-i-h-g-h-i-j------------
--------------j-i-h-i-j--------------
----------------j-i-j----------------
------------------j------------------
The center of the rangoli has the first alphabet letter a, and the boundary has the alphabet letter (in alphabetical order).

Function Description

Complete the rangoli function in the editor below.

rangoli has the following parameters:

int size: the size of the rangoli
Returns

string: a single string made up of each of the lines of the rangoli separated by a newline character (\n)
Input Format

Only one line of input containing , the size of the rangoli.

Constraints


Sample Input

5
Sample Output

--------e--------
------e-d-e------
----e-d-c-d-e----
--e-d-c-b-c-d-e--
e-d-c-b-a-b-c-d-e
--e-d-c-b-c-d-e--
----e-d-c-d-e----
------e-d-e------
--------e--------

https://www.hackerrank.com/challenges/alphabet-rangoli/problem?isFullScreen=false

I got this from hackerrank, check out the link for better understanding
ProgrammingRe: Codewars.com Coding Challenges by Fr4nk(op): 8:29pm On May 17, 2022
Altairx440:
Lol its OK, you should go first then, post a challenge you are comfortable solving, we could just be on the same level since we are age mates.
Age mates (I'm guessing you checked my profile).
Okay bro
My main language is python,
I'm still in limbo between intermediate and advanced but I'll try best.
I just started Data structures and algorithms so I haven't really learnt Asymptotic notation and all those Big O analysis stuff
ProgrammingRe: Codewars.com Coding Challenges by Fr4nk(op): 3:44pm On May 17, 2022
Altairx440:
Say, I give a coding challenge, you solve and post your solution, if possible with the Big O/complexity and you do same. Is this approach ok?
Maybe, just to be clear I no too sabi, but I love a good challenge, so expect rubbish code that works lol grin
ProgrammingRe: Why Is Web Development The Most Commonly Talked About Career In Nigerian Tech by Fr4nk(op): 2:00pm On May 17, 2022
WUdec:
Wasn't a pun. Was actually being serious
Okay
ProgrammingRe: Codewars.com Coding Challenges by Fr4nk(op): 1:58pm On May 17, 2022
Altairx440:
I have stopped Codewars.com, but I'm in for some coding challenges, you interested?
Sure
ProgrammingRe: Why Is Web Development The Most Commonly Talked About Career In Nigerian Tech by Fr4nk(op): 8:36am On May 17, 2022
WUdec:
Lovely mindset. Have you created any exciting products lately?
By working on something exciting I wasn't talking about groundbreaking personal projects or being the next mark zuckerberg,
An example of something exciting I would love to participate in is Artificial Intelligence at Deepmind, a lot of "exciting" research and development goes on there, they're at the cutting edge of Artificial Intelligence. Isn't that exciting? Imagine working at NASA or SpaceX, and you're among the brilliant devs working together with the rest of the team (astronauts, aerospace engineers, astrophysicists etc) to put the first man on mars, amazing ryt? There are so many examples of exciting stuff. (But excitement differs from person to person)
ProgrammingRe: I Want To Learn Programming. Which Language Should I Start With? by Fr4nk(m): 11:35pm On May 16, 2022
Ayowoleminiyi:
Hello, good evening everyone!

i just started learning Python programming, I need someone interested in learning to signify if we can learn together and hold each other accountable, also any veteran python programmer who is interested in assisting me should kindly reply or please send a dm.

Mucha gracias.
Hello, I'm not a beginner and I'm also not a veteran but I would love to be of help wink
ProgrammingRe: Chronicle Of A Data Scientist/analyst by Fr4nk(m): 9:41am On May 16, 2022
avalon7:
Starting young is definitely an advantage. Are you in college already? If you aren't then you can pick a related course like computer science or maths/statistics. Nigerian universities will probably not teach you most of what you need to get a job so you should do a lot of self learning while studying. Just be sure that data science is what you'd like to do.
Data science or Artificial Intelillgence
I might be leaning more to the Artificial Intelligence part tho,
I'm hoping to study CS at unilorin (since I bleeped up my WASSCE and NECO by not writing further maths), I'm not going to rely on the university to teach me everything, I can definitely learn a few important stuff on my own.
ProgrammingCodewars.com Coding Challenges by Fr4nk(op): 1:03am On May 16, 2022
I really love this site Codewars.com and their coding challenges, I wonder if there are coders here who use the platform, let's meet and maybe we might just form our own clan (maybe we could call it "Naira code ninjas" grin lol)
ProgrammingRe: Why Is Web Development The Most Commonly Talked About Career In Nigerian Tech by Fr4nk(op): 11:22am On May 15, 2022
airsaylongcome:
Not some. Most. And it’s not a bad thing. There has to be a reason for doing something. I personally kind of stay away from those driving by the so-called money in IT. Back in the day when Computer Science was seen as a course for rejects and never-do-wells, and yahoo boys, it took passion to ignore all the insults and denigrating comments
I just graduated from high school last year, so I don't really know much about real life, that's why I still believe in coding for the love of it or "passion".
ProgrammingRe: Projected Recession In The US And Possible Impact On Availability Of Remote Jobs by Fr4nk(m): 8:31am On May 15, 2022
airsaylongcome:
You know they pay those US resident Data Scientists those figures to cover the cost of living in HCOL locations. And they pay taxes to the US governments. 99% of Nigerian remote workers don’t pay tax in anyway or form. I am saying if you want to earn $160k then you should also be living in New York paying rent of 2k per month
Okay, I understand

How about this:
Getting paid the Nigerian equivalent of earning $160K in US,
Not #160K o grin
ProgrammingRe: Projected Recession In The US And Possible Impact On Availability Of Remote Jobs by Fr4nk(m): 8:20am On May 15, 2022
airsaylongcome:
How do you determine the salary “they deserve”. Surely someone in a HCOL city like LA should earn more than a LCOL city like Ibadan
Devs should be paid what they deserve based on their skills and the services they offer, if an American company is going to pay an American Data scientist $160k then a Nigerian Data Scientist working for the same company with similar skills and qualification deserves similar pay, just because I'm from Nigeria shouldn't make me cheap labour.
ProgrammingRe: Why Is Web Development The Most Commonly Talked About Career In Nigerian Tech by Fr4nk(op): 8:10am On May 15, 2022
Fmghewzy:
You just capping ,are you not a Nigerian .
Why would you say Nigerian dev code for a living.
Yet you said you code for the passion.

Learn to use the right words and stop generalizing
Apologies sir, i didn't mean to generalize, its just that some the ones I've met always gave me that impression of coding for a living,
Maybe saying `some 9ja devs` would have been better
ProgrammingRe: Projected Recession In The US And Possible Impact On Availability Of Remote Jobs by Fr4nk(m): 7:03am On May 15, 2022
Techstar:
I think a recession will be good news for Nigerian devs. Many companies will outsource to remote devs because it is a far cheaper option than paying devs resident in U.S. Imagine paying a Frontend, US based dev $20,000 while you can pay 2 Nigerian devs $1000 each and get better results
This is why most US devs have problems getting jobs because they have to compete with blokes in developing countries who will accept low salaries instead of the salaries they deserve
ProgrammingRe: Why Is Web Development The Most Commonly Talked About Career In Nigerian Tech by Fr4nk(op): 6:59am On May 15, 2022
Sheddy5:
bro, does learning python programing involve reading and practice?
Well, yes it does undecided
Unless you're a visual learner who prefers watching videos
Python video tutorials are also available to you

1 2 3 (of 3 pages)