Posts

Implementing Linked List

Document Top addFirst() addLast() removeFirst() display() main() Output LINKED LIST IMPLEMENTATION class SinglyLinkedList1 { // Node class private static class Node { String data; Node next; Node(String data) { this.data = data; this.next = null; } } Singly Linked List variables private Node head; // points to the first node private Node tail; // points to the last node private int size; // tracks number of nodes Constructor public SinglyLinkedList1() { head = null; tail = null; size = 0; } To insert an element at the head (beginning) of the list: // Create a new node containing the new element. // Set its next reference to the current head node. // Reassign the head to point to this new node. // Increase the list size by one. // ...

Dice-Random

Image
Document Generate a Random Number

Counter

Image
Document 0 Decrease Increase Reset

Ratio and Proportions

Ratio & Proportion — Aptitude Questions Ratio & Proportion — Aptitude Questions Q1 The monthly emoluments of A and B are in the ratio 3 : 4, while the ratio of their expenditures stands at 4 : 5. If A manages to accumulate ₹600 as savings and B retains ₹800, what is A’s monthly income? Q2 Two quantities are in the ratio 5 : 7. If both are augmented by 20 units, the revised proportion becomes 7 : 9. Determine the original numbers. Solution: Let numbers be 5x and 7x. (5x+20)/(7x+20)=7/9 ⇒ x=10 ⇒ numbers = 50 and 70 . Q3 The ratio of the ages of a father and his son is 7 : 3. After 6 years, the ratio transforms into 9 : 5. Ascertain their present ages. Solution: Let ages be 7x and 3x. (7x+6)/(3x+6)=9/5 ⇒ x=3 ⇒ Father = 21 yrs , Son = 9 yrs . Q4 In a mixture, the pr...

57.Longest Sequence between same character

Image
Print longest sequence between same character Example: I/p abcccccbba O/p 8 (from a to a) I/p aaaaaaaa O/p 6
LeetCode practice builds problem-solving muscles, but interviews are about communicating your thinking in real time and showing that you can adapt when constraints shift. That’s why the same problems that feel trivial alone at your desk can suddenly feel like walls in front of an interviewer. Here are the big gaps you’ve already noticed (and they’re spot on): Thinking out loud: Interviewers want to see your reasoning, not just your final code. Handling changes: They’ll often tweak constraints to test flexibility. Pattern recognition: Spotting whether a problem is, say, sliding window, two-pointer, or DP in disguise. Under-pressure optimization: Interview timing forces you to balance brute force vs. efficient solutions fast. That’s exactly why mock interviews (with peers, mentors, or tools like Leeco AI you mentioned) are so valuable — they recreate the pressure + interaction dynamic that pure grinding doesn’t. suggestions: Don’t stop solving problems, but fr...

56.Remove string 2 froM String 1

Image
Problem of the Day: Given two Strings s1 and s2, remove all the characters from s1 which is present in s2. Input: s1=”expErIence” s2="E" output: s1=”exprIece” Input: s1 = "Programming" s2 = "P" Output: rogramming