Skip to content

Instantly share code, notes, and snippets.

View wpsadi's full-sized avatar
😇
Evolving

Aditya wpsadi

😇
Evolving
View GitHub Profile
@wpsadi
wpsadi / shadcn-bun-components.txt
Created May 29, 2025 10:34
adding everything in shadcn library
bun add @tanstack/react-table
bun add next-themes
bunx --bun shadcn@latest add tooltip button accordion alert alert-dialog aspect-ratio avatar badge breadcrumb calendar card carousel chart checkbox collapsible command context-menu table dialog drawer dropdown-menu form hover-card input input-otp label menubar navigation-menu pagination popover progress radio-group resizable scroll-area select separator sheet sidebar skeleton slider slider switch tabs textarea toast toggle toggle-group
@wpsadi
wpsadi / Store.js
Created October 31, 2024 19:44
Zustand Code without persist
import { create } from "zustand";
import { immer } from "zustand/middleware/immer";
export const useTodoStore = create(
immer((set, get) => ({
hydrated: false,
setHydrated() {
set({ hydrated: true });
},
@wpsadi
wpsadi / authStore.ts
Created October 24, 2024 09:57
Zustand Store code
import { create } from "zustand";
import { immer } from "zustand/middleware/immer";
import { persist } from "zustand/middleware";
interface IAuthStore {
hydrated: boolean;
setHydrated(): void;
}
export const useAuthStore = create<IAuthStore>()(
def can_travel(N, M, route_A, route_B, X, Y):
# Convert the stops of Route A and B
set_A = set(route_A)
set_B = set(route_B)
# Case 1: travel directly within Route A or Route B
if X in set_A and Y in set_A:
return "Yes" # If both source and destination are in Route A
if X in set_B and Y in set_B:
return "Yes" # If both source and destination are in Route B
#include <iostream>
#include <vector>
#include <unordered_set>
using namespace std;
string can_travel(int N, int M, vector<int>& route_A, vector<int>& route_B, int X, int Y) {
// Convert both routes to sets for quick lookup
unordered_set<int> set_A(route_A.begin(), route_A.end());
unordered_set<int> set_B(route_B.begin(), route_B.end());
@wpsadi
wpsadi / README.md
Created May 31, 2024 15:27 — forked from piyushgarg-dev/README.md
Kafka Crash Course
@wpsadi
wpsadi / DeciToBin.c
Last active October 30, 2023 17:02
Write a program in C language that converts any decimal number to it binary value. There is one condition : No use of any library function to convert directly
//Please Solve This
#include <stdio.h>
#include <string.h>
int main()
{
int val = 1000;
char Bin[100];
int i = 0;
@wpsadi
wpsadi / Matrix Multiply.c
Created October 30, 2023 10:30
Write a program in C language that performs Matrix Multiplication
#include <stdio.h>
int main()
{
printf("To perform a Matrix Multiplication, We Would need you to Enter the 2 matrices ;");
// matrix 1 is being created
printf("\n\nFor Matrix 1\n\n");
printf("How many Rows will be in your matrix : ");
@wpsadi
wpsadi / Reverse without creating Copy.c
Created October 30, 2023 08:40
Write a C program that takes an array and then prints the same array in reverse order. But there are 2 conditions: (i)You can't create a Temporary array (ii) No use of any library function
#include <stdio.h>
int lenCharArr(char arr[]);// calculates the length of the array
void revCharArr(char arr[]);// swaps the characters in the array
int main(){
// char x = '*';
char charArr[] = {"aditya is legend"};
revCharArr(charArr);
@wpsadi
wpsadi / create Matrix.c
Created October 30, 2023 07:36
Write a Program in C language that takes value to create a matrix, but firstly it should ask for the order of the matrix
#include <stdio.h>
int main(){
printf("To Create a Matrix, We Would need you to Enter these details ;");
printf("\n\n");
printf("How many Rows will be in your matrix : ");
int row;
scanf("%d",&row);