From 6d0fa8ecdcda4a5246a17f74117be24cde6da1e3 Mon Sep 17 00:00:00 2001 From: ashmichheda Date: Fri, 6 Nov 2020 18:21:17 -0700 Subject: [PATCH] added solution for 1283 --- README.md | 1 + .../java/com/fishercoder/solutions/_1283.java | 32 ++++++++++++++++++ src/test/java/com/fishercoder/_1283Test.java | 33 +++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 src/main/java/com/fishercoder/solutions/_1283.java create mode 100644 src/test/java/com/fishercoder/_1283Test.java diff --git a/README.md b/README.md index fe370cdc58..4c995e3883 100644 --- a/README.md +++ b/README.md @@ -173,6 +173,7 @@ _If you like this project, please leave me a star._ ★ |1289|[Minimum Falling Path Sum II](https://leetcode.com/problems/minimum-falling-path-sum-ii/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1289.java) | |Hard|Dynamic Programming| |1287|[Element Appearing More Than 25% In Sorted Array](https://leetcode.com/problems/element-appearing-more-than-25-in-sorted-array/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1287.java) | [:tv:](https://youtu.be/G74W8v2yVjY) |Easy|| |1286|[Iterator for Combination](https://leetcode.com/problems/iterator-for-combination/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1286.java) | |Medium|Backtracking, Design| +|1283|[Find the Smallest Divisor Given a Threshold](https://leetcode.com/problems/find-the-smallest-divisor-given-a-threshold/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1283.java) | Medium | |1282|[Group the People Given the Group Size They Belong To](https://leetcode.com/problems/group-the-people-given-the-group-size-they-belong-to/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1282.java) | [:tv:](https://www.youtube.com/watch?v=wGgcRCpSAa8)|Medium|| |1281|[Subtract the Product and Sum of Digits of an Integer](https://leetcode.com/problems/subtract-the-product-and-sum-of-digits-of-an-integer/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1281.java) | |Easy|| |1277|[Count Square Submatrices with All Ones](https://leetcode.com/problems/count-square-submatrices-with-all-ones/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1277.java) | |Medium|| diff --git a/src/main/java/com/fishercoder/solutions/_1283.java b/src/main/java/com/fishercoder/solutions/_1283.java new file mode 100644 index 0000000000..9f4ab27fa1 --- /dev/null +++ b/src/main/java/com/fishercoder/solutions/_1283.java @@ -0,0 +1,32 @@ +package com.fishercoder.solutions; + +public class _1283 { + public static class Solution{ + private boolean isSumLessThanThreshold(int middle, int[] nums, int threshold){ + int sum = 0; + for(int i = 0; i