ANNU KUMARImyfirstblog123.hashnode.dev·Apr 24, 2024System.exit() method in JavaHii Folks, As everyone knows, Java is a multi-platform, object-oriented programming language that runs on billions of devices worldwide. and Today, I'm going to write about one of its methods which is System.exit(). In an earlier article, I wrote abo...Discuss·1 like·30 readsJava
Gulshan Kumarperfinsights.hashnode.dev·Apr 21, 2024Count the Number of Special Characters IYou are given a string word. A letter is called special if it appears both in lowercase and uppercase in word. Return the number of special letters in word. LeetCode Problem - 3120 import java.util.*; class Solution { // Function to count the nu...DiscussJava SolutionJava
Gulshan Kumarperfinsights.hashnode.dev·Apr 21, 2024Jewels and StonesYou're given strings jewels representing the types of stones that are jewels, and stones representing the stones you have. Each character in stones is a type of stone you have. You want to know how many of the stones you have are also jewels. Letters...DiscussJava Solutionhashmap
Gulshan Kumarperfinsights.hashnode.dev·Apr 21, 2024Truncate SentenceA sentence is a list of words that are separated by a single space with no leading or trailing spaces. Each of the words consists of only uppercase and lowercase English letters (no punctuation). For example, "Hello World", "HELLO", and "hello world...DiscussJava SolutionJava
Gulshan Kumarperfinsights.hashnode.dev·Apr 21, 2024Score of a StringYou are given a string s. The score of a string is defined as the sum of the absolute difference between the ASCII values of adjacent characters. Return the score of s. LeetCode Problem - 3110 class Solution { public int scoreOfString(String s) {...DiscussJava SolutionJava
Gulshan Kumarperfinsights.hashnode.dev·Apr 21, 2024Reveal Cards In Increasing OrderYou are given an integer array deck. There is a deck of cards where every card has a unique integer. The integer on the i<sup>th</sup> card is deck[i]. You can order the deck in any order you want. Initially, all the cards start face down (unrevealed...DiscussJava SolutionJava
Gulshan Kumarperfinsights.hashnode.dev·Apr 21, 2024Uncommon Words from Two SentencesA sentence is a string of single-space separated words where each word consists only of lowercase letters. A word is uncommon if it appears exactly once in one of the sentences, and does not appear in the other sentence. Given two sentences s1 and s2...DiscussJava SolutionJava
Gulshan Kumarperfinsights.hashnode.dev·Apr 21, 2024Valid Parenthesis StringGiven a string s containing only three types of characters: '(', ')' and '*', return true if s is valid. The following rules define a valid string: Any left parenthesis '(' must have a corresponding right parenthesis ')'. Any right parenthesis ')' ...DiscussJava SolutionJava
ANNU KUMARImyfirstblog123.hashnode.dev·Apr 18, 2024The String Data Type in Java Programming LanguageIn my previous blog, I wrote about the history of Java Programming Language. After that, I'm going to write about Strings in Java programming language. The String is a sequence of characters. The char type represents only one character. To represent ...Discuss·1 like·59 readsJava
Gulshan Kumarperfinsights.hashnode.dev·Apr 16, 2024Binary Number with Alternating BitsGiven a positive integer, check whether it has alternating bits: namely, if two adjacent bits will always have different values. LeetCode Problem - 693 class Solution { // Method to check if the binary representation of a number has alternating b...DiscussJava SolutionJava