10lakh subscribers
Please like, Share and subscribe to my channel.


Hi Everyone,
Welcome to My Channel


krinity

Linear probing is used to open addressing for handle the collision

11 months ago | [YT] | 0

krinity

Huffman coding problem in greedy algorithm

11 months ago | [YT] | 0

krinity

Count unique elements
--------------------------------------------


Problem Description:

You are given an array A of N integers. Return the count of elements with frequncy 1 in the given array.





Problem Constraints

1 <= N <= 105
1 <= A[i] <= 109





Input Format:

First argument A is an array of integers.


Output Format:

Return an integer.





Example Input

Input 1:
A = [3, 4, 3, 6, 6]
Input 2:
A = [3, 3, 3, 9, 0, 1, 0]




Example Output

Output 1:
1
Output 2:
2


def solve(self, A):
fm={}
for i in A:
if i in fm:
fm[i]+=1
else:
fm[i]=1
count=0
for i in A:
if fm[i]==1:
count+=1
return count

1 year ago | [YT] | 0

krinity

Count Occurrences(String)
-----------------------------------------
Problem Description:


Find the number of occurrences of bob in string A consisting of lowercase English alphabets.


Problem Constraints:

1 <= |A| <= 1000




Input Format:

The first and only argument contains the string A, consisting of lowercase English alphabets.




Output Format:

Return an integer containing the answer.




Example Input

Input 1:

"abobc"
Input 2:

"bobob"





Example Output

Output 1:

1
Output 2:

2





Example Explanation

Explanation 1:

The only occurrence is at second position.
Explanation 2:

Bob occures at first and third position.



class Solution:
# @param A : string
# @return an integer
def solve(self, A):
count = 0
for i in range(len(A) - 2): # Loop until len(A) - 2 to avoid index out of range
if A[i:i+3] == "bob": # Check if substring from i to i+3 is "bob"
count += 1
return count

1 year ago | [YT] | 0

krinity

Power BI

1 year ago | [YT] | 1

krinity

Java flow

1 year ago | [YT] | 1

krinity

HashMap(example), reverse the string, palindrome the string, Binary Search,bubble sort and selection sort, dynamic input getting from user in hashmap

2 years ago | [YT] | 0

krinity

2 years ago | [YT] | 1

krinity

2 years ago | [YT] | 0