# Category: Java

## Coins and Triangle in Java …FTC

Chef belongs to a very rich family which owns many gold mines. Today, he brought N gold coins and decided to form a triangle using…

## Help Mommy out …fcukthecode

Mommy is a very active lady. She likes to keep all stuff sorted. She has developed an interesting technique of sorting stuff over the years.…

## Bubble Sort… – FcukTheCode

Parameter Description Stable Yes In place Yes Best case complexity O(n) Average case complexity O(n^2) Worst case complexity O(1) The BubbleSort compares each successive pair…

## Occurrences of the Given Digit in Java …fcukthecode

Calculate the number of occurrences of the given input digit in the given numbers. InputThe first line of input consists of a single integer T,…

## Occurrences of the digit 4 Java .. – FTC

Kostya likes the number 4 much. Of course! This number has such a lot of properties, like: Four is the smallest composite number; It is…

## Huffman Coding : Change-making problem ..:- fcukthecode

Huffman Coding -: Greedy Algorithms ðŸ‘‡ ðŸ‘‡ ðŸ™‚Link –> HUFFMAN CODING Given a money system, is it possible to give an amount of coins and…

## Huffman Coding – Activity Selection Problem

Huffman Coding -: Greedy Algorithms ðŸ‘‡ ðŸ‘‡ ðŸ™‚Link –> HUFFMAN CODING The ProblemYou have a set of things to do (activities). Each activity has a…

## Binary Addition in Java …fcukthecode

Write a Java program to add two binary numbers. INPUT_1:Enter the Binary 1:Â  010Enter the Binary 2:Â  011 OUTPUT:Addition of the two binary number isÂ …

## Selection Sorting in Java …fcukthecode

Sort the given set of numbers using Selection Sort. The first line of the input contains the number of elements, The second line of the…

## Average value of array element [Java] …ftc

Write a Java Program to Calculate the average value of array element.Refer the testcases INPUT_1:Enter n number:Â  4Enter n arrays:Â  34Â  89Â  100Â  78 OUTPUT:Average…

## Match string with rotated string in java …ftc

Write a java Java program to check whether one string is rotation of another string. INPUT_1:String s1:  string1234String s2:  1234string OUTPUT:s2 is a rotated version…

## Maximum occurring character in Java ..ftc

Given a string, Write an efficient java method to return maximum occurring character in the input string E.g., if input string is “test” then function…

## First half of the string – Java program …ftc

Write a Java program for, Given a string of even length, return the first half. INPUT_1:Enter any String:Â  Deadpool OUTPUT:Dead INPUT_2:Enter any String:Â  fcukthecode.co OUTPUT:fcukthe…

## Java program to create a Triangle …ftc

Java program to create a Triangle. INPUT_1:Enter any number:Â  5 OUTPUT:*************** INPUT_2:Enter any number:Â  4 OUTPUT:********** INPUT_3:Enter any number:Â  2 OUTPUT:*** INPUT_4:Enter any number:Â  10…

## Magician’s Numbers in Java …fcukthecod

This problem practices the addition of 2-digit numbers. Encourage the students to share the methods that they use to solve the problem. For example some…

## Harmonic Number in Java …ftc

Print the sum of nth harmonic number: 1/1 + 1/2 + â€¦ + 1/n. Note: Use Double Data type and String.format(“%.02f”, variable name) INPUT_1:Enter nth…

## Number Pattern 111111 in Java …ftc

Write a program to print following outputs. 1111111111112211113331114444115555516666667777777 INPUT_1:Enter any number:Â  7 OUTPUT:1111111111112211113331114444115555516666667777777 INPUT_2:Enter any number:Â  5 OUTPUT:1111111122113331444455555 INPUT_3:Enter any number:Â  6 OUTPUT:111111111122111333114444155555666666 INPUT_4:Enter any…

## Conversion from binary to decimal in Java …ftc

Java Program to convert from binary to decimal number. INPUT_1:Binary:Â  1101 OUTPUT:Decimal:Â  13 INPUT_2:Binary:Â  111 OUTPUT:Decimal:Â  7 INPUT_3:Binary:Â  001 OUTPUT:Decimal:Â  1 INPUT_4:Binary:Â  1111 OUTPUT:Decimal:Â  15…

## Swap numbers by multiplication and division in Java …ftc

Swapping two numbers by multiplication and division Java Program to Swap two numbers by using division and multiplication. INPUT_1:Enter any two numbers:Â  3Â  2 OUTPUT:Swapped…

## Conversion from Octal to hexadecimal in Java …ftc

Java Program to convert from octal to hexadecimal number. INPUT_1:Enter Octal number:Â  10453 OUTPUT:Hexadecimal number is:Â  112B INPUT_2:Enter Octal number:Â  10452 OUTPUT:Hexadecimal number is:Â  112A…