Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#telsuko #navinreddy #10dayschallenge #4193

Closed
antivirustoai opened this issue May 19, 2023 · 1 comment
Closed

#telsuko #navinreddy #10dayschallenge #4193

antivirustoai opened this issue May 19, 2023 · 1 comment
Labels
awaiting triage Awaiting triage from a maintainer

Comments

@antivirustoai
Copy link

What would you like to share?

import java.util.HashMap;
import java.util.Map;

class HelloWorld {
private static Map<String, Integer> cache = new HashMap<>();

public static void main(String[] args) {
    int n = 5, i, j;
    for (i = 0; i < n; i++) {
        for (j = 0; j <= i; j++) {
            System.out.print(array(i, j) + " ");
        }
        System.out.println();
    }
}

private static int array(int row, int col) 
{
    if (col==0||col==row)
        return 1;

    String key = row + "-" + col;
    if (cache.containsKey(key))
        return cache.get(key);

    int result = array(row - 1, col - 1) + array(row - 1, col);
    cache.put(key, result);
    return result;
}

}

Additional information

No response

@antivirustoai antivirustoai added the awaiting triage Awaiting triage from a maintainer label May 19, 2023
@siriak
Copy link
Member

siriak commented May 20, 2023

Please create a pull request with a detailed description of the algorithm instead

@siriak siriak closed this as completed May 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting triage Awaiting triage from a maintainer
Projects
None yet
Development

No branches or pull requests

2 participants