Whats the first thing to consider before solving a code challenge | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Whats the first thing to consider before solving a code challenge

Problem solving

18th Jul 2020, 12:03 PM
Abraham Zimba
Abraham Zimba - avatar
8 Answers
+ 14
Do I have a glass of water, a snack, paper and pencil on my dektop.
18th Jul 2020, 12:05 PM
Oma Falk
Oma Falk - avatar
+ 8
𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥 dehydration is not good for brain. Also Sebastian Keßler never forgets sth. to drink if he codes. 🤫🤫🤫🤫 I take both:chocolate and red wine.
18th Jul 2020, 2:14 PM
Oma Falk
Oma Falk - avatar
+ 6
Abraham Zimba Although it looks funny, it is serious. 1. Did I understand the problem? Hopefully I have enough examples. 2. Regard a problem as a chain of other problems -> split problem until you can solve all sub problems 3. Describe subproblems on paper. Sketches might help 4. How far u split depends on your experience. 5. Transfer subproblems to methods or functions. But a method/function should not have too much lines(some say 5 lines not more) @chillpill is master of sketches on papers. 𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥 posted a nice challenge: which word has the most anagrams in a given sentence? Given: a sentence Looking for: word with most anagrams Sure what an anagram is? Okay Transform sentence to words Do I know a given hack? If not... ask google If I have a collection of words: which are pairwise anagrams? I have an idea for a function that decides if two words are anagrams after 10 minutes or ask SL community...
18th Jul 2020, 2:57 PM
Oma Falk
Oma Falk - avatar
+ 3
...now a function of(word, listofwords)--> number of anagrams in list of words ... for each word number of anagrams. ...finally word with max number of anagrams(hopefully part of your repertoire...else ask SL with link to own effort) As you see - I advice google and post question. I think, learning from other peoples snippets increases own knowledge more than hours of brain aching search for a not so good solution.
18th Jul 2020, 3:04 PM
Oma Falk
Oma Falk - avatar
+ 2
Consider yourself first is can u able solve that problem
18th Jul 2020, 12:28 PM
Aayush $aini
Aayush $aini - avatar
+ 2
Thanks pals. Though what I meant was 'is there a systematic way of solving challenges?'
18th Jul 2020, 2:19 PM
Abraham Zimba
Abraham Zimba - avatar
+ 2
Thanks very much Oma Falk this really helpful
18th Jul 2020, 3:04 PM
Abraham Zimba
Abraham Zimba - avatar
+ 2
Time complexity and what data structure you use in the problem
19th Jul 2020, 8:42 AM
Jahanzaib Shahid
Jahanzaib Shahid - avatar