![]() Note: Python regular expression library has been imported as re.Ĭ) pattern = ‘(+i|+ie)(,)’ What should be the value of “pattern” in regular expression? What number should be mentioned instead of “_” to index only the domains?ġ2. “aaa”, “bbb”.) you write the following code: “”” In order to extract only the domain names from the email addresses from the above string (for eg. Str = “””Email_Address,Nickname,Group_Status,Join_Year It is required to define the set by including the keyword ‘set’.ġ1. Which options are correct to create an empty set in Python? Solution: C, There is no indexing in Sets.ġ0. Which among them is incorrect for set s = Solution: B It Counts the number of times the substring ‘abb’ is present starting from position 2 and ending at position 11 in the given string.ĩ. Solution: B, If A is proper subset of B then len all elements of A are in B but B contains at least one element that is not in B. Suppose we have two sets A & B, then A ![]() If the string is not found by method find(), it returns the integer -1. Another approach is to sort both of the arrays and then just go through them sequentially until you don’t have a match. Check the difference and then you have your missing element. Since, we know all the numbers are non-negative. There are two straight forward approaches. Solution: There are many possible solutions for this problem. Try to solve this problem in multiple ways. Given these two arrays, find which element is missing in the second array. ![]() A second array is formed by shuffling the elements of the first array and deleting a random element. Consider an array of non-negative integers. That means for every price we’re going to keep track of the lowest price so far and then check if we can get a better profit than out current max profit.Ĥ. We will iterate through the list of stock prices while keeping track of our maximum profit. In this case, we will use a greedy algorithm approach. Solution: One thing to think about right off the bat is that we cannot just find the maximum proce and the lowest price and then subtract the two, because the max could come before the min. Hint: You should be able to solve this problem by only going through the array once! Given You make the most profit by buying on day 3(price of $2) and selling on day 4 (price of $10), netting you an $8 gain. Let’s see an example of this with the example array of stock prices. Also no shorting the stock, you have to buy before selling. You are only allowed to buy the stock once and sell it once. Write an algorithm that figures out what days (index of array) you could buy and sell the stock for maximum profit. You are given an array of historical stock prices per day, for example. Once we detect a change in letter, we “compress” that series with its count. ![]() Solution: Our strategy is to go along the string, keeping a running count of the current letter series. The function should also be case sensitive, so that a string ‘AAAaaa’ returns ‘A3a3’. For instance, it is okay for ‘AAB’ to return ‘A2B1’ even though this technically takes more space. For this problem, you can falsely “compress” strings of single or souble letters. Given a string in the form ‘AAAABBBBCCCCCDDEEEE’ compress it to become ‘A4B4C5D2E4’. Want to know More about Data Science? Click hereĢ. Then the result would be the largest negative number. Note that we don’t reset the current sum to 0 because the array can contain all negative integers. When the current sum becomes negative, we start with a new current sum because a negative current sum will only decrease the sum of a future sequence. As long as the current sum is positive, we keep adding the numbers. ![]() After adding each element, we check whether the current sum is larger than maximum sum encountered so far. Solution: The algorithm is, we start summing up the numbers and store in a current sum variable. You need to return the total sum amount, not the sequence. Given an array of integers (positive and negative) write a program that can find the largest continuous sum. Workday Security Configuration & Testingīlogs videos INTERVIEW & CERTIFICATIONS QUESTIONS TUTORIALS Data Science – Coding Interview Questions Category: Data Science Posted:Mar 29, 2019īy: Ashley Morrison 6119 Views 0 Commentsġ.SAP SuccessFactors Onboarding & Recruiting.Business Analysis in Healthcare with Facets.SAP S4HANA Central Finance Online Training ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |