Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,152,601 members, 7,816,493 topics. Date: Friday, 03 May 2024 at 11:56 AM |
Nairaland Forum / Science/Technology / Programming / Codewars.com Coding Challenges (2369 Views)
Coding Challenges As A Newbie. / CODELAGOS: 337 Schools To Participate In Coding Competition / Do We Have Coding Bootcamps In Nigeria? / Faster Way To Learn Web Development. (2) (3) (4)
Codewars.com Coding Challenges by Fr4nk(m): 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" lol) 2 Likes |
Re: Codewars.com Coding Challenges by Altairx440: 1:40pm On May 17, 2022 |
Fr4nk:I have stopped Codewars.com, but I'm in for some coding challenges, you interested? 1 Like |
Re: Codewars.com Coding Challenges by Fr4nk(m): 1:58pm On May 17, 2022 |
Altairx440: Sure |
Re: Codewars.com Coding Challenges by Altairx440: 2:19pm On May 17, 2022 |
Fr4nk: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? 1 Like |
Re: Codewars.com Coding Challenges by Fr4nk(m): 3:44pm On May 17, 2022 |
Altairx440: Maybe, just to be clear I no too sabi, but I love a good challenge, so expect rubbish code that works lol 4 Likes |
Re: Codewars.com Coding Challenges by Altairx440: 6:19pm On May 17, 2022 |
Fr4nk: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. 1 Like |
Re: Codewars.com Coding Challenges by Fr4nk(m): 8:29pm On May 17, 2022 |
Altairx440: 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 1 Like |
Re: Codewars.com Coding Challenges by Fr4nk(m): 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 |
Re: Codewars.com Coding Challenges by Altairx440: 11:08pm On May 17, 2022 |
Fr4nk:I saw your post on some data science thread, that's how I found out. I use python too though just for the time being, I too have not taking a DSA course but I've already got the hang of Big O, so just ignore it. |
Re: Codewars.com Coding Challenges by Altairx440: 11:21pm On May 17, 2022 |
I came up with two different ways to solve this problem, and after implementing them they both work just fine, So I'm posting both solutions. |
Re: Codewars.com Coding Challenges by Altairx440: 11:23pm On May 17, 2022 |
I'm unable to post the python code, I'll try again tomorrow. 1 Like |
Re: Codewars.com Coding Challenges by Altairx440: 12:15pm On May 18, 2022 |
# solution 1: def segment(i, n): |
Re: Codewars.com Coding Challenges by Altairx440: 12:38pm On May 18, 2022 |
. |
Re: Codewars.com Coding Challenges by Altairx440: 12:39pm On May 18, 2022 |
. |
Re: Codewars.com Coding Challenges by Altairx440: 12:39pm On May 18, 2022 |
. |
Re: Codewars.com Coding Challenges by Altairx440: 12:40pm On May 18, 2022 |
# solution 2: def print_rangoli(x): |
Re: Codewars.com Coding Challenges by Fr4nk(m): 2:08pm On May 18, 2022 |
These are way too complex bro, I'll test them out |
Re: Codewars.com Coding Challenges by Fr4nk(m): 2:10pm On May 18, 2022 |
The first one worked well |
Re: Codewars.com Coding Challenges by Fr4nk(m): 2:13pm On May 18, 2022 |
Second one worked well too |
Re: Codewars.com Coding Challenges by Fr4nk(m): 2:13pm On May 18, 2022 |
Here's my solution
|
Re: Codewars.com Coding Challenges by Altairx440: 2:26pm On May 18, 2022 |
Fr4nk:Nice solution bro, You should also be the posting the source code of your solutions so I can test yours as well. Nairaland flags the "chr" function call, so you'll have to swap names in your solutions just like i did. |
Re: Codewars.com Coding Challenges by Altairx440: 2:42pm On May 18, 2022 |
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 1 Like |
Re: Codewars.com Coding Challenges by Fr4nk(m): 6:47pm On May 18, 2022 |
Altairx440: Why is s3 an empty list? |
Re: Codewars.com Coding Challenges by Altairx440: 8:54pm On May 18, 2022 |
Fr4nk:List s3 is an empty list because string s3 contains a header with no accompanying rows, specifically, string s3 has a "Name" and "Age" column, but no rows, you should not create an empty object. |
Re: Codewars.com Coding Challenges by Fr4nk(m): 12:55am On May 19, 2022 |
Okay cool, Your calling them objects, aren't they dictionaries lol You sound like someone coming from JavaScript |
Re: Codewars.com Coding Challenges by Altairx440: 5:52am On May 19, 2022 |
Fr4nk:Of course, JavaScript was my first language lol, plus it's mostly called "object" or "map/hashmap" in other languages. 1 Like |
Re: Codewars.com Coding Challenges by excanny: 1:22pm On May 19, 2022 |
Is any other language allowed? |
Re: Codewars.com Coding Challenges by Fr4nk(m): 2:03pm On May 19, 2022 |
Altairx440: Yeah dictionaries / objects are Hashmaps, Any language is allowed sir 1 Like |
Re: Codewars.com Coding Challenges by Altairx440: 2:10pm On May 19, 2022 |
excanny:Yes! |
Re: Codewars.com Coding Challenges by Altairx440: 2:15pm On May 19, 2022 |
Fr4nk:Yeah, also seems like you did not learn JavaScript, is Python the only language you know? 1 Like |
Re: Codewars.com Coding Challenges by excanny: 5:08pm On May 19, 2022 |
Got it working in C# 2 Likes
|
Re: Codewars.com Coding Challenges by Fr4nk(m): 7:43pm On May 19, 2022 |
Altairx440: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 1 Like |
Whats The Difference B/w Mysql And Sql: Do They Relate? / Junit: How To Set Classpath On Windows Xp / Oracle Primavera P6-introduction To Basic Pdf(with Screenshots) Free
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 38 |