about | help | code help+videos | done | prefs |
Your goal is to determine if an x-value is in the given domain. Write a mehtod with two input parameters. The first parameter is x, which is the x-value to test. The second parameter is domain which is an array of integers. This array indicates intervals that are in the domain (end-points included). For example, the array {4,5,17,19} indicates a domain of [4,5] [17,19]. The array will have an even number of elements and the intervals will not overlap. The intervals will not be listed in any particular order so {4,5,17,19} indicates the same domain as {17,19,4,5}. Return true if the x-value is in the domain. Return false otherwise. Note that the domain only has integer end-points, but the x-value will be a double. The x-value will be somewhere between the lowest possible integer and the greatest possible integer. The domain will contain at least one interval. inDomain(30.0, [-3, 2, 8, 12, 30, 300]) → true inDomain(30.04, [-5, 5, 8, 14, 30, 300]) → true inDomain(298.0, [-7, 250, 800, 1200, 3000, 30000]) → false ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 420
Copyright Nick Parlante 2017 - privacy