In C, you can use scanf to get character input from console. However, if you do it multiple times, you will realize that pressing enter after the first scanf affects the next scanf call. This happens when you have a space after your prompt, e.g. printf("Choice: "); char c; scanf("%c"). Either don't put a space at the end of printf or use a space in scanf like so: scanf(" %c")
Wednesday, December 28, 2022
Friday, September 16, 2022
When is inheritance useful?
A major disadvantage of inheritance is not being able to follow the program flow by ctrl + clicking function calls due to some functionality being implemented in ancestor classes. Therefore, I prefer composition over inheritance whenever possible. The one case where inheritance shines is reusing workflows. Let's say all your child classes have a run() method that calls f1(), f2() and f2() in order, where f1, f2, f3 functions are implemented in child classes. If we move the run() method to the ancestor class, child classes would just call that run method, saving you from duplicating the f1, f2, f3 calls in each child.
Monday, September 5, 2022
Studying Algorithms and Data Structures Effectively
ARRAYS & HASHING
| 01 | Easy | Contains Duplicate |
| 02 | Easy | Valid Anagram |
| 03 | Easy | Two Sum |
| 04 | Medium | Group Anagrams |
| 05 | Medium | Top K Frequent Elements |
| 06 | Medium | Valid Sudoku |
| 07 | Medium | Product of Array Except Self |
| 08 | Medium | Longest Consecutive Sequence |
TWO POINTERS
| 09 | Easy | Valid Palindrome |
| 10 | Medium | Two Sum II Input Array Is Sorted |
| 11 | Medium | 3Sum |
| 12 | Medium | Container With Most Water |
SLIDING WINDOW
| 13 | Easy | Best Time to Buy And Sell Stock |
| 14 | Medium | Longest Substring Without Repeating Characters |
| 15 | Medium | Longest Repeating Character Replacement |
STACK
| 16 | Easy | Valid Parentheses |
| 17 | Medium | Min Stack |
| 18 | Medium | Daily Temperatures |
BINARY SEARCH
| 19 | Easy | Binary Search |
| 20 | Medium | Find Minimum In Rotated Sorted Array |
| 21 | Medium | Search In Rotated Sorted Array |
LINKED LIST
| 22 | Easy | Reverse Linked List |
| 23 | Easy | Merge Two Sorted Lists |
| 24 | Medium | Reorder List |
| 25 | Medium | Remove Nth Node From End of List |
| 26 | Easy | Linked List Cycle |
| 27 | Medium | LRU Cache |
TREES
| 28 | Easy | Invert Binary Tree |
| 29 | Easy | Maximum Depth of Binary Tree |
| 30 | Easy | Diameter of Binary Tree |
| 31 | Easy | Balanced Binary Tree |
| 32 | Easy | Same Tree |
| 33 | Easy | Subtree of Another Tree |
| 34 | Medium | Lowest Common Ancestor of a Binary Search Tree |
| 35 | Medium | Binary Tree Level Order Traversal |
| 36 | Medium | Binary Tree Right Side View |
| 37 | Medium | Count Good Nodes In Binary Tree |
| 38 | Medium | Validate Binary Search Tree |
| 39 | Medium | Kth Smallest Element In a Bst |
HEAP / PRIORITY QUEUE
| 40 | Easy | Kth Largest Element In a Stream |
| 41 | Easy | Last Stone Weight |
| 42 | Medium | Kth Largest Element In An Array |
GRAPHS
| 43 | Medium | Number of Islands |
| 44 | Medium | Max Area of Island |
| 45 | Medium | Clone Graph |
| 46 | Medium | Pacific Atlantic Water Flow |
| 47 | Medium | Surrounded Regions |
| 48 | Medium | Course Schedule |
| 49 | Medium | Course Schedule II |
29.10.2025: leetcode-75
Thursday, August 11, 2022
Leetcode notes
Friday, July 29, 2022
Behavioral interview preparation as a student
From Google to Toptal, behavioral questions are an integral part of the interview process. Questions like "what did you do when you realized that the deadline could not be met", "tell me about a case where your teammate was underperforming and your response" try to assess your communication and conflict resolution skills. As a student, you should treat such crisis as opportunites. A bad way to handle teammates that do not shoulder their share is to quarrel with them and take their share too without trying to negotiate a settlement. You should at least get their point of view in a coolheaded manner. Even if you cannot win them over for the cause, you will improve your communication skills and you will have stories to tell in interviews. Watch this video for tips.
Sunday, June 26, 2022
Podcast with a sofware engineer working in Munich
I recently did a podcast (in Turkish) with my cousin who works as the software engineering department head of a company in Munich. In it, we also answered the following questions which were previously asked by my mentee, Nansy:
Question: Did he have to learn on his own or was his university knowledge sufficient?
Answer: You have to learn on your own too.
Question: How important is GPA really?
Answer: Not much if you don't plan to do graduate studies. If your GPA is not great, you have to be able to give reasons for it. Good reasons: Worked on my projects/hobbies, worked part time, traveled around the world. Bad reasons: Watched movies, played games.
Question: How can someone decide which area/language/framework to learn and focus on when there are so many?
Answer: Picking an industry/sector will narrow down the selection. Make sure that your computer engineering fundamentals like algorithms and data structures are sound.
Saturday, June 25, 2022
Summer project ideas
- Create a fork and push your updates to this fork.
- Draw a polygon (e.g. hexagon) on map. Zoom - unzoom with mouse wheel. Drawing should be updated while zooming, it should not wait until mouse wheel stops.
- Pan with the right mouse click and drag. Drawing should be updated while panning, it should not wait until mouse button is released.
- Show country borders.
- On startup, map should center on Turkey and Turkey borders should fill the view.
- Document your progress/challenges, preferably create a public blog and write a developer diary there.