Python : First Smallest and Largest Words in the String | Python Interview Questions | Target FAANG
Video 145: In this video, we'll explore how to find the first smallest and largest words in the string. We are given a string, provide the first smallest and largest words in the string. In this video, we explore two different approaches to solve the problem of finding the smallest and largest words in a string using Python. The task is to provide the first smallest and largest words in the given string. Approach 1: Using Variables and Check We start by splitting the input string into individual words. Then, we initialize variables to hold the smallest and largest words found so far. We iterate through each word, updating the smallest and largest words if necessary. Finally, we return the smallest and largest words in a dictionary format. Approach 2: Using Dictionary and Check Similar to Approach 1, we split the input string into words and initialize a dictionary to hold the smallest and largest words. We then iterate through each word, updating the dictionary values accordingly based on word length. Finally, we return the result dictionary containing the smallest and largest words. We implement both approaches and compare their efficiency and readability. You'll learn about the importance of choosing the right data structures and how they can impact the clarity and performance of your code. For a comprehensive understanding and practical demonstration, be sure to watch the entire video. Happy coding! code: https://github.com/jeganpillai/python_reference/blob/main/p0058_first_smallest_and_largest_words_in_the_string.py Follow me on, Website : https://growwithdata.co/ YouTube : https://www.youtube.com/@growwithdata TikTok : https://www.tiktok.com/@growwithdata LinkedIn : https://www.linkedin.com/company/growwithdata/ Facebook : https://www.facebook.com/growwithdata.co/ twitter : https://twitter.com/growwithdata_co WhatsApp : https://whatsapp.com/channel/0029VaF8pkb77qVNfbp5pA0S Instagram : https://www.instagram.com/growwithdata.co/ #recursive #countingalgorithm #list #looping #listmanipulation #uniquesubstring #longestsubstring #slicing #lineartimecomplexity #python #pythonquestions #pythontest #pythonprogramming #pythontutorial #python3 #pythonforbeginners #interviewquestions #interview #dataengineers #deinterview #pythoninterview #interviewquestions #leetcode #placementpreparation #meta #google #facebook #apple #netflix #amazon #google #faang #maanga #dataengineers #alphanumeric #nonalphanumeric #growwithdata #set #split #remove #pythonfunctions #tamil #tamilpython #tamilinterview #tamilinterviewlatest
Download
0 formatsNo download links available.