Home / 2022 / September

Monthly Archives: September 2022

How to fetch API Data from API in React Using useEffect?

import React, { useState, useEffect } from "react"; // Use can use css from this file: import "./styles.css"; const url = "https://jsonplaceholder.typicode.com/posts"; function App() { const [userData, setUserData] = useState({}); const getUserData = async () => { const response = await fetch(url); const jsonData = await response.json(); setUserData(jsonData); }; useEffect(() …

Read More »

Given an array of integers a, your task is to count the number of pairs i and j (where 0 ≤ i < j < a.length), such that a[i] and a[j] are digit anagrams.

Given an array of integers a, your task is to count the number of pairs i and j (where 0 ≤ i < j < a.length), such that a[i] and a[j] are digit anagrams. Two integers are considered to be digit anagrams if they contain the same digits. In other …

Read More »