Code Monkey home page Code Monkey logo

java-hacktoberfest's Introduction

Hi there šŸ‘‹

setco-website/setco-website is a āœØ special āœØ repository because its README.md (this file) appears on your GitHub profile.

Here are some ideas to get you started:

  • šŸ”­ Iā€™m currently working on ...
  • šŸŒ± Iā€™m currently learning ...
  • šŸ‘Æ Iā€™m looking to collaborate on ...
  • šŸ¤” Iā€™m looking for help with ...
  • šŸ’¬ Ask me about ...
  • šŸ“« How to reach me: ...
  • šŸ˜„ Pronouns: ...
  • āš” Fun fact: ...

java-hacktoberfest's People

Contributors

anirudh-raj avatar prathibhas avatar setco-website avatar

Watchers

 avatar  avatar

java-hacktoberfest's Issues

arraySumAdjacentDifference

Given array of integers, find the sum of absolute differences of consecutive numbers.

Example

For inputArray = [4, 7, 1, 2], the output should be
arraySumAdjacentDifference(inputArray) = 10.

  • |4 - 7| = 3;
  • |7 - 1| = 6;
  • |1 - 2| = 1

So, the answer is 3 + 6 + 1 = 10.

Input/Output

  • [execution time limit] 3 seconds (java)

  • [input] array.integer inputArray

    Guaranteed constraints:
    3 ā‰¤ inputArray.length ā‰¤ 10,
    1 ā‰¤ inputArray[i] ā‰¤ 15.

  • [output] integer

    • Sum of absolute differences of consecutive numbers from inputArray.

[Java] Syntax Tips

// Prints help message to the console
// Returns a string
// 
// Globals declared here will cause a compilation error,
// declare variables inside the function instead!
String helloWorld(String name) {
    System.out.println("This prints to the console when you Run Tests");
    return "Hello, " + name;
}

DigitSum

Given an integer, find the sum of all its digits.

Example

For n = 111, the output should be digitSum(n) = 3.

1 + 1 + 1 = 3.

Input/Output

  • [execution time limit] 3 seconds (java)

  • [input] integer n

    Guaranteed constraints:
    0 ā‰¤ n ā‰¤ 2 Ā· 109.

  • [output] integer

[Java] Syntax Tips

// Prints help message to the console
// Returns a string
// 
// Globals declared here will cause a compilation error,
// declare variables inside the function instead!
String helloWorld(String name) {
    System.out.println("This prints to the console when you Run Tests");
    return "Hello, " + name;
}

FirstDuplicate

Given an array a that contains only numbers in the range from 1 to a.length, find the first duplicate number for which the second occurrence has the minimal index. In other words, if there are more than 1 duplicated numbers, return the number for which the second occurrence has a smaller index than the second occurrence of the other number does. If there are no such elements, return -1.

Example

  • For a = [2, 1, 3, 5, 3, 2], the output should be firstDuplicate(a) = 3.

    There are 2 duplicates: numbers 2 and 3. The second occurrence of 3 has a smaller index than the second occurrence of 2 does, so the answer is 3.

  • For a = [2, 2], the output should be firstDuplicate(a) = 2;

  • For a = [2, 4, 3, 5, 1], the output should be firstDuplicate(a) = -1.

Input/Output

  • [execution time limit] 3 seconds (java)

  • [input] array.integer a

    Guaranteed constraints:
    1 ā‰¤ a.length ā‰¤ 105,
    1 ā‰¤ a[i] ā‰¤ a.length.

  • [output] integer

    • The element in a that occurs in the array more than once and has the minimal index for its second occurrence. If there are no such elements, return -1.

[Java] Syntax Tips

// Prints help message to the console
// Returns a string
// 
// Globals declared here will cause a compilation error,
// declare variables inside the function instead!
String helloWorld(String name) {
    System.out.println("This prints to the console when you Run Tests");
    return "Hello, " + name;
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.