๐๐ข๐ฌ๐ญ๐ซ๐ข๐๐ฎ๐ญ๐๐ ๐๐๐๐ก๐ ๐๐ฒ๐ฌ๐ญ๐๐ฆ: One of the most interesting concepts in system design.
๐๐ก๐๐ญ ๐ข๐ฌ ๐๐๐๐ก๐?
A cache is a data storage component that can be hardware or software. It enables the client to find data more quickly than other types of memory.
๐๐ก๐๐ญ ๐ข๐ฌ ๐๐ข๐ฌ๐ญ๐ซ๐ข๐๐ฎ๐ญ๐๐ ๐๐๐๐ก๐ ๐๐ฒ๐ฌ๐ญ๐๐ฆ?
If the data is too large to be served by a single cache on a single machine, a distributed machine is required to serve the clients' requests in a scalable and distributed manner. This is referred to as a distributed cache system.
๐๐จ๐ฐ ๐๐ข๐ฌ๐ญ๐ซ๐ข๐๐ฎ๐ญ๐๐ ๐๐๐๐ก๐ ๐๐ฒ๐ฌ๐ญ๐๐ฆ ๐ฐ๐จ๐ซ๐ค๐ฌ?
Generally, a Distributed Cache is based on a Distributed Hash Table(DHT) (a decentralized storage system that provides lookup and storage schemes similar to a hash table for storing key-value pairs.) which is similar to a hash table but spread across multiple nodes. By managing the addition, DHT enables a distributed cache to scale on the fly.
๐๐จ๐ฐ ๐๐จ ๐ฐ๐ ๐๐ฏ๐ข๐๐ญ ๐ญ๐ก๐ ๐๐๐๐ก๐ ๐๐ง๐ ๐ฐ๐ก๐๐ง ๐๐จ ๐ฐ๐ ๐ง๐๐๐ ๐ญ๐จ ๐๐ฏ๐ข๐๐ญ ๐ญ๐ก๐ ๐๐๐๐ก๐?
Eviction means removing key and value entries from the cache memory, as the cache is expensive, and not all the values present there are always being used. So we need to identify which entry is not being used and is sitting at the location ideally.
One of the common strategies is โLeast Recently Usedโ or LRU. Delete the entry which is recently being used.
๐๐จ๐ฐ ๐๐๐ง ๐ฐ๐ ๐ฌ๐ฉ๐๐๐ ๐ฎ๐ฉ ๐ญ๐ก๐ ๐ฉ๐ซ๐จ๐๐๐ฌ๐ฌ?
We need a service that serves get/put/delete requests; even though we're using RAM, which is fast, it's still blocking calls.
We can use 2 Logic:
- spawn n no of threads as and when we get the requests or we can have a bigger thread pool to handle thread.
- Event-driven logic.
๐๐ก๐๐ญ ๐ข๐ฌ ๐๐๐๐ก๐?
A cache is a data storage component that can be hardware or software. It enables the client to find data more quickly than other types of memory.
๐๐ก๐๐ญ ๐ข๐ฌ ๐๐ข๐ฌ๐ญ๐ซ๐ข๐๐ฎ๐ญ๐๐ ๐๐๐๐ก๐ ๐๐ฒ๐ฌ๐ญ๐๐ฆ?
If the data is too large to be served by a single cache on a single machine, a distributed machine is required to serve the clients' requests in a scalable and distributed manner. This is referred to as a distributed cache system.
๐๐จ๐ฐ ๐๐ข๐ฌ๐ญ๐ซ๐ข๐๐ฎ๐ญ๐๐ ๐๐๐๐ก๐ ๐๐ฒ๐ฌ๐ญ๐๐ฆ ๐ฐ๐จ๐ซ๐ค๐ฌ?
Generally, a Distributed Cache is based on a Distributed Hash Table(DHT) (a decentralized storage system that provides lookup and storage schemes similar to a hash table for storing key-value pairs.) which is similar to a hash table but spread across multiple nodes. By managing the addition, DHT enables a distributed cache to scale on the fly.
๐๐จ๐ฐ ๐๐จ ๐ฐ๐ ๐๐ฏ๐ข๐๐ญ ๐ญ๐ก๐ ๐๐๐๐ก๐ ๐๐ง๐ ๐ฐ๐ก๐๐ง ๐๐จ ๐ฐ๐ ๐ง๐๐๐ ๐ญ๐จ ๐๐ฏ๐ข๐๐ญ ๐ญ๐ก๐ ๐๐๐๐ก๐?
Eviction means removing key and value entries from the cache memory, as the cache is expensive, and not all the values present there are always being used. So we need to identify which entry is not being used and is sitting at the location ideally.
One of the common strategies is โLeast Recently Usedโ or LRU. Delete the entry which is recently being used.
๐๐จ๐ฐ ๐๐๐ง ๐ฐ๐ ๐ฌ๐ฉ๐๐๐ ๐ฎ๐ฉ ๐ญ๐ก๐ ๐ฉ๐ซ๐จ๐๐๐ฌ๐ฌ?
We need a service that serves get/put/delete requests; even though we're using RAM, which is fast, it's still blocking calls.
We can use 2 Logic:
- spawn n no of threads as and when we get the requests or we can have a bigger thread pool to handle thread.
- Event-driven logic.
Java Hyd Team
OracleDatabaseNotesForProfessionals (1).pdf
Keep these notes always it will help you in everything related to Oracle database
//Write a java program accept date of birth from scanner and check eligible for vote ?
import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
System.out.print("Input your date of birth (yyyy-mm-dd) : ");
String inputString = in.nextLine();
if (inputString.length() != 10)
{
System.out.println("Error: Invalid length");
}
else
{
String[] date = inputString.split("-");
int year = Integer.parseInt(date[0]);
int month = Integer.parseInt(date[1]);
int day = Integer.parseInt(date[2]);
if (year < 2002)
{
System.out.println("You are eligible to vote.");
}
else
{
if (year > 2002)
{
System.out.println("You are not eligible to vote.");
}
else
{
if (month < 10)
{
System.out.println("You are eligible to vote.");
}
else
{
if (month > 10)
{
System.out.println("You are not eligible to vote.");
}
else
{
if (day <= 27)
{
System.out.println("You are eligible to vote.");
}
else
{
System.out.println("You are not eligible to vote.");
}
}
}
}
}
}
}
}
import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
System.out.print("Input your date of birth (yyyy-mm-dd) : ");
String inputString = in.nextLine();
if (inputString.length() != 10)
{
System.out.println("Error: Invalid length");
}
else
{
String[] date = inputString.split("-");
int year = Integer.parseInt(date[0]);
int month = Integer.parseInt(date[1]);
int day = Integer.parseInt(date[2]);
if (year < 2002)
{
System.out.println("You are eligible to vote.");
}
else
{
if (year > 2002)
{
System.out.println("You are not eligible to vote.");
}
else
{
if (month < 10)
{
System.out.println("You are eligible to vote.");
}
else
{
if (month > 10)
{
System.out.println("You are not eligible to vote.");
}
else
{
if (day <= 27)
{
System.out.println("You are eligible to vote.");
}
else
{
System.out.println("You are not eligible to vote.");
}
}
}
}
}
}
}
}
This is correct code but this brute code will update you with correct n small code for the same
Keep one offer in hand and negotiate with others again keep an offer of a higher package and negotiate for a higher package
import java.util.*;
public class PalidromeNumber {
public static void main(String[] args) {
Scanner x = new Scanner (System.in);
System.out.println("Enter value to check palidrome or not Palidrome");
String s1= x.next();
String s2 = "";
for(int i= s1.length()-1;i>=0;i--) {
s2 = s2+ s1.charAt(i);
}if (s1.equals(s2)) {
System.out.println("The entered number "+s1+" is a palindrome number ");
}else{
System.out.println("The entered number "+s1+" is not a palindrome number ");
}
}
}
class PalidromeNumber1 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter the number: ");
int num=sc.nextInt();
int r,sum=0;
int temp=num;
while(num>0)
{
r=num%10;
sum=(sum*10)+r;
num=num/10;
}
if(temp==sum)
System.out.println("The entered number "+temp+" is a palindrome number ");
else
System.out.println("The entered number "+temp+" is not a palindrome");
}
}
public class PalidromeNumber {
public static void main(String[] args) {
Scanner x = new Scanner (System.in);
System.out.println("Enter value to check palidrome or not Palidrome");
String s1= x.next();
String s2 = "";
for(int i= s1.length()-1;i>=0;i--) {
s2 = s2+ s1.charAt(i);
}if (s1.equals(s2)) {
System.out.println("The entered number "+s1+" is a palindrome number ");
}else{
System.out.println("The entered number "+s1+" is not a palindrome number ");
}
}
}
class PalidromeNumber1 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter the number: ");
int num=sc.nextInt();
int r,sum=0;
int temp=num;
while(num>0)
{
r=num%10;
sum=(sum*10)+r;
num=num/10;
}
if(temp==sum)
System.out.println("The entered number "+temp+" is a palindrome number ");
else
System.out.println("The entered number "+temp+" is not a palindrome");
}
}
static List<EdM1>list2= List.of(new EdM1(1001,"Kannababu","m",40000,"Hyderabad","EIE"),new EdM1(1002,"Srinivas","m",42000,"Chennai","CSE"));
public static void main(String[] args) {
list2.forEach(System.out::println);
public static void main(String[] args) {
list2.forEach(System.out::println);
Microsoft is Hiring for 2023 batch Software Engineer
Role: SDE
Passout year: 2023
Qualification: B.tech/BE/MCA/M.tech/BCA
Branch: CS/IT/EE/ECE/EEE
Ctc : 42 Lpa - 46 Lpa
Location: Bangalore, Hyderabad, Noida
Apply now - https://careers.microsoft.com/us/en/job/1494883/Software-Engineering-Full-Time-Opportunity-for-University-Graduates
Telegram: @stockkida
WhatsApp: https://chat.whatsapp.com/F7kqpKp6WFZJQiuTXpYH1K
Role: SDE
Passout year: 2023
Qualification: B.tech/BE/MCA/M.tech/BCA
Branch: CS/IT/EE/ECE/EEE
Ctc : 42 Lpa - 46 Lpa
Location: Bangalore, Hyderabad, Noida
Apply now - https://careers.microsoft.com/us/en/job/1494883/Software-Engineering-Full-Time-Opportunity-for-University-Graduates
Telegram: @stockkida
WhatsApp: https://chat.whatsapp.com/F7kqpKp6WFZJQiuTXpYH1K
Top LeetCode questions asked in Google Interviews for SDE role (PART-1) ๐
๐ Please don't ignore this post, it took a lot of effort & time to research & create this post. Many of us are preparing for the interviews to get placed in top product-based companies and #Leetcode is one of the good platforms to practice the #DSA questions.
๐Here is a list of questions (Part-1) which recently asked by Google during the interviews. The questions and their respective links are in the same order. The content source is the Internet and Leetcode.
โพQUESTIONS :-
- H-Index
- Poor Pigs
- Valid Square
- Decode String
- Text Justification
- Battleships in a Board
- Minimum Time Difference
- Longest Absolute File Path
- Student Attendance Record II
- Evaluate Reverse Polish Notation
- Longest Increasing Path in a Matrix
โพLinks:-
- https://lnkd.in/dVy49_Nr
- https://lnkd.in/daX_YFyX
- https://lnkd.in/dvq8H_2w
- https://lnkd.in/dDpYv6G5
- https://lnkd.in/dYNWn5N3
- https://lnkd.in/d29shXsD
- https://lnkd.in/dGAuhsvh
- https://lnkd.in/dHD-2TVZ
- https://lnkd.in/dbnqgbkA
- https://lnkd.in/dCX4BzSE
- https://lnkd.in/dmEWHdSd
๐ If you find it useful, give it a like and save it. Feel free to comment with your thoughts and queries. Don't forget to save this Post. Also share it with your friends and colleagues out there.๐ญ
tags-
#coding #datastructures #algorithms #google #interview #computerscience #softwareengineer #data #programming
๐ Please don't ignore this post, it took a lot of effort & time to research & create this post. Many of us are preparing for the interviews to get placed in top product-based companies and #Leetcode is one of the good platforms to practice the #DSA questions.
๐Here is a list of questions (Part-1) which recently asked by Google during the interviews. The questions and their respective links are in the same order. The content source is the Internet and Leetcode.
โพQUESTIONS :-
- H-Index
- Poor Pigs
- Valid Square
- Decode String
- Text Justification
- Battleships in a Board
- Minimum Time Difference
- Longest Absolute File Path
- Student Attendance Record II
- Evaluate Reverse Polish Notation
- Longest Increasing Path in a Matrix
โพLinks:-
- https://lnkd.in/dVy49_Nr
- https://lnkd.in/daX_YFyX
- https://lnkd.in/dvq8H_2w
- https://lnkd.in/dDpYv6G5
- https://lnkd.in/dYNWn5N3
- https://lnkd.in/d29shXsD
- https://lnkd.in/dGAuhsvh
- https://lnkd.in/dHD-2TVZ
- https://lnkd.in/dbnqgbkA
- https://lnkd.in/dCX4BzSE
- https://lnkd.in/dmEWHdSd
๐ If you find it useful, give it a like and save it. Feel free to comment with your thoughts and queries. Don't forget to save this Post. Also share it with your friends and colleagues out there.๐ญ
tags-
#coding #datastructures #algorithms #google #interview #computerscience #softwareengineer #data #programming
LinkedIn
LinkedIn: Log In or Sign Up
1 billion members | Manage your professional identity. Build and engage with your professional network. Access knowledge, insights and opportunities.