- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Suppose, we are given the tasks to transport several metal bars of different sizes. But the transportation container is short in length, it can contain bars of length 1 only. We are provided n number of bars, and their lengths are given to us in a list. So, to fit all the bars in the container; we have to cut and divide all the bars so they are of unit sizes. Further, we fit all the bars into the container that cost us one operation. We have to find the number of operations we have to perform on the bars.So, ... Read More
Suppose, a person wants to buy a product of price x. But each passing day, the price of the product increases x times the price of the previous day. We have to find out the price of the product after y days since the person has made up his mind to purchase the product. If the price of the product is too much, then the answer is given as price modulo 10^9 + 7. The input is given in a list of pairs; the first value of the pair is the initial price x and the second value is y, ... Read More
Suppose, we are given several different pairs in the format (x, y). Here the x signifies the base of a number and y signifies the number itself. In the list there are pairs that mean the same. We have to check the number of matches in the given number pairs. The given pairs can be redundant, and can also contain invalid base-number combinations.So, if the input is like num_inputs = 2, input_arr = [(10, 15), (8, 17)], then the output will be 1.The variable num_inputs specify the number of inputs, and the array input_arr lists the number pairs. Here if ... Read More
Suppose, there are n number of student groups waiting to get back from their college to their home via the college bus. In each student group, there are m number of students. The student groups want to travel by bus without getting separated. They board the bus if and only if all the members of their group can get on the bus. Also, a group does not board the bus if their previous group has not boarded the bus or has already reached their destination. If we are given the number of groups and the number of students in each ... Read More
To change the local user account password using PowerShell, we can use the Set-LocalUser command with the Password parameter. This password parameter should be in the secure string. So we need to ask the user to input the password as a secure string or need to explicitly convert the plain text password to the secure string. For example, $localuser = Read-Host "Enter Local UserName" $password = Read-Host "Enter local user account password " -AsSecureString Set-LocalUser -Name $localuser -Password $password -VerboseIf you need to set the password without asking the user prompt then you need to convert the plain text password ... Read More
Suppose we have a matrix of order m x n called accounts where accounts[i][j] is the amount of money of ith customer present in jth bank. We have to find the wealth that the richest customer has. A customer is richest when he/she has maximum amount considering all banks.So, if the input is like102015305201051215123then the output will be 55 as the money of second person is 30+5+20 = 55, which is maximum.To solve this, we will follow these steps −max_balue := 0ind_value := 0for i in range 0 to row count of accounts - 1, doind_value := sum of all ... Read More
Suppose we have a sequence of characters called s, we say a string w is k-repeating string if w is concatenated k times is a substring of sequence. The w's maximum k-repeating value will be the highest value k where w is k-repeating in sequence. And if w is not a substring of the given sequence, w's maximum k-repeating value is 0. So if we have s and w we have to find the maximum k-repeating value of w in sequence.So, if the input is like s = "papaya" w = "pa", then the output will be 2 as w ... Read More
Suppose we have two string type arrays word1 and word2, we have to check whether the two arrays represent the same string or not. We can say a string can be represented by an array if the elements in that array are concatenated in order forms the string.So, if the input is like word1 = ["ko", "lka", "ta"] word2 = ["k", "olk", "at", "a"], then the output will be True as both are forming "kolkata".To solve this, we will follow these steps −s1:= blank string, s2:= blank stringfor each string i in word1, dos1 := s1 concatenate ifor each string ... Read More
Suppose there is a bomb that you are going to defuse, and your time is running out! You have a a circular array code of length of n and have a key k. Now to decrypt the code, you must replace every number. All the numbers are replaced simultaneously. There are few rules −If k > 0 then replace ith number with the sum of next k numbers.If k < 0 then replace ith number with the sum of previous k numbers.If k = 0 then replace ith number with 0.Here the code is circular, so the next element of ... Read More
We can retrieve the file extension using multiple ways. First, using the [System.IO.Path] class.PS C:\> [System.IO.Path]::GetExtension("C:\temp\25Aug2020.txt") .txt PS C:\> [System.IO.Path]::GetExtension("C:\temp\azcopy.zip") .zipThis is the easiest way to get the file extension. Otherways, Using programmatically, PS C:\> ((Split-Path "C:\Temp\azcopy.zip" -Leaf).Split('.'))[1] zip PS C:\> ((Split-Path "C:\Temp\25Aug2020.txt" -Leaf).Split('.'))[1] txtUsing Get-ChildItem, PS C:\> (Get-ChildItem C:\Temp\azcopy.zip).Extension .zip PS C:\> (Get-ChildItem C:\Temp\25Aug2020.txt).Extension .txtUsing Get-Item, PS C:\> (Get-Item C:\Temp\azcopy.zip).Extension .zipRead More
To Continue Learning Please Login
Login with Google